【发布时间】:2019-09-16 15:02:19
【问题描述】:
我正在尝试在 Azure 上运行 Nuxt.js 应用程序。当我使用 Azure Devops CI/CD 将应用程序(成功)部署到 Azure Web 应用程序时,应用程序将无法运行。
查看下面的错误。
据我了解,这意味着无法找到 package.json,因此无法启动应用程序。
我在 Azure Devops here 上的构建/发布管道的图像。
2019-09-11T08:09:27.409935226Z _____
2019-09-11T08:09:27.409972726Z / _ \ __________ _________ ____
2019-09-11T08:09:27.409980026Z / /_\ \___ / | \_ __ \_/ __ \
2019-09-11T08:09:27.409985426Z / | \/ /| | /| | \/\ ___/
2019-09-11T08:09:27.409990326Z \____|__ /_____ \____/ |__| \___ >
2019-09-11T08:09:27.409995626Z \/ \/ \/
2019-09-11T08:09:27.410000626Z A P P S E R V I C E O N L I N U X
2019-09-11T08:09:27.410005526Z
2019-09-11T08:09:27.410009926Z Documentation: http://aka.ms/webapp-linux
2019-09-11T08:09:27.410014626Z NodeJS quickstart: https://aka.ms/node-qs
2019-09-11T08:09:27.410019226Z NodeJS Version : v10.16.0
2019-09-11T08:09:27.410023826Z
2019-09-11T08:09:27.781011935Z /opt/startup/init_container.sh: line 32: [: ==: unary operator expected
2019-09-11T08:09:28.029460609Z Oryx Version : 0.2.20190730.1, Commit: 4ef0d5854df39c57605e59bb6d255215cc85468a
2019-09-11T08:09:28.067056450Z
2019-09-11T08:09:28.093996380Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2019-09-11T08:09:28.094015980Z Could not find operation ID in manifest. Generating an operation id...
2019-09-11T08:09:28.094229780Z Build Operation ID: 3b273fa4-2c0a-44fe-82d5-d3558b0f435e
2019-09-11T08:09:28.981601858Z Writing output script to '/opt/startup/startup.sh'
2019-09-11T08:09:28.992611670Z Running #!/bin/sh
2019-09-11T08:09:28.993286971Z
2019-09-11T08:09:28.993302171Z # Enter the source directory to make sure the script runs where the user expects
2019-09-11T08:09:28.993319471Z cd "/home/site/wwwroot"
2019-09-11T08:09:28.993325871Z
2019-09-11T08:09:28.994364772Z if [ -z "$PORT" ]; then
2019-09-11T08:09:28.994378572Z export PORT=8080
2019-09-11T08:09:28.994997373Z fi
2019-09-11T08:09:28.995010873Z
2019-09-11T08:09:28.995015273Z PATH="$PATH:/home/site/wwwroot" npm run start:prod
2019-09-11T08:09:31.501668636Z npm ERR! path /home/site/wwwroot/package.json
2019-09-11T08:09:31.502666537Z npm ERR! code ENOENT
2019-09-11T08:09:31.518772254Z npm ERR! errno -2
2019-09-11T08:09:31.518809454Z npm ERR! syscall open
2019-09-11T08:09:31.520098056Z npm ERR! enoent ENOENT: no such file or directory, open '/home/site/wwwroot/package.json'
2019-09-11T08:09:31.521179157Z npm ERR! enoent This is related to npm not being able to find a file.
2019-09-11T08:09:31.522101458Z npm ERR! enoent
2019-09-11T08:09:31.640775689Z
2019-09-11T08:09:31.641914090Z npm ERR! A complete log of this run can be found in:
2019-09-11T08:09:31.646957596Z npm ERR! /root/.npm/_logs/2019-09-11T08_09_31_532Z-debug.log
但是,当我检查 wwwroot 的索引时,我可以看到我的应用程序不存在。只有一个“S”目录包含应用程序。这些文件是如何进入这个“S”目录的?
如何将它们取出或更改工作目录以使脚本不会失败?
【问题讨论】:
-
你能分享你的 Azure Pipeline 吗?可能在部署步骤中。
-
您的部署似乎有问题,能否请您再分享一些部署步骤?
-
有关我的构建/发布管道的更多信息,请参阅this link
-
@janekkkkk 您是否尝试过以下解决方案?进展如何?
标签: node.js azure azure-devops azure-web-app-service nuxt.js