【发布时间】:2021-10-16 08:58:25
【问题描述】:
我目前使用 github 操作将 next.js 部署到 azure 应用服务时遇到问题。 虽然我正在尝试部署,但我不断收到一条错误消息,提示“没有这样的文件或目录”
yaml文件和下面的一样
Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy Node.js app to Azure Web App - clsreact3
on:
push:
branches:
- master
env:
AZURE_WEPAPP_NAME: clsreact3
AZURE_WEBAPP_PACKAGE_PATH: '.'
NODE_VERSION: '14.x'
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: npm install, build, and test
run: |
# Build and test the project, then
# deploy to Azure Web App.
npm install
npm run build --if-present
npm run test --if-present
working-directory: my-app-path
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
如果需要更多信息,请参阅此处。 https://github.com/scl2589/next.js-tutorial
谢谢:)
【问题讨论】:
-
不确定错误,但您的项目显示不正确。在 package.json 你有启动脚本(和开发脚本):
node server.js而你的项目没有server.js文件。此外,避免混合包管理器。我可以看到yarn.lock和package-lock.json。您确定该项目甚至可以在您的系统上运行吗?另外,不要结帐node_modules。将其添加到.gitignore。
标签: azure next.js azure-web-app-service github-actions