在Azure Web应用上启动时出现Nuxt.js应用错误

时间:2019-09-11 10:18:29

标签: node.js azure azure-devops azure-web-sites nuxt.js

我正在尝试在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”目录?

如何删除它们或更改工作目录,以使脚本不会失败?

Imgur

1 个答案:

答案 0 :(得分:1)

我想您可能会意外地检查构建管道中存档文件任务中的选项 Prepend root folder name to archive paths 。选中此选项将最终使文件进入“ S” 文件夹。

enter image description here

请检查您构建管道中的任务Achive Files,确保未选中Prepend root folder name to archive paths