我试图在Azure中部署一个Web应用程序,使用Github Actions构建成功,但随后容器在Azure中崩溃,并且我得到一个关于'cross-env'包的权限被拒绝的错误,这是我的package.json中的依赖项。该项目在当地运行良好。
控制台
2023-10-12T21:27:43.947743248Z
2023-10-12T21:27:43.947747649Z npm start
2023-10-12T21:27:45.373528228Z npm info using [email protected]
2023-10-12T21:27:45.373565332Z npm info using [email protected]
2023-10-12T21:27:45.459141307Z
2023-10-12T21:27:45.459175710Z > [email protected] start
2023-10-12T21:27:45.459182911Z > cross-env NODE_ENV=production nodemon ./bin/www
2023-10-12T21:27:45.459188211Z
2023-10-12T21:27:45.531346836Z sh: 1: cross-env: Permission denied
2023-10-12T21:27:51.870Z ERROR - Container MyProject didn't respond to HTTP pings on port: 8080,
failing site start.
2023-10-12T21:27:51.873Z INFO - Stopping site MyProject because it failed during startup.
package.json
"scripts": {
"start": "cross-env NODE_ENV=production nodemon ./bin/www",
"dev": "cross-env NODE_ENV=development nodemon ./bin/www",
},
"engines": {
"node": ">=18.17.0"
},
"dependencies": {
"cross-env": "^5.2.0",
"npm": "^9.6.4",
"nodemon": "^1.19.0",
...
...
},
1条答案
按热度按时间hec6srdp1#
我试着在我的**
package.json
中使用cross-env
**,并添加了一个启动命令来使用cross-env
初始化示例nodejs express应用程序。在验证应用程序在本地成功运行后,我通过Github Actions部署了它,它成功运行参考下面:-本地安装跨环境命令:-
我的包。json:-
我将本地代码推送到Github存储库,并通过Azure Web应用部署中心部署,如下所示:
我的github工作流程:-
我的仓库:-
Reference
输出:-