[英]Build failed in azure devops even though package.json file is present in the Repo
I am trying to publish my code to azure web app services through azure devops, i have added the code to build repo by creating a folder and it is simple hello world nodejs app, which is working file in local system, But when i create a new build i get this error我正在尝试通过 azure devops 将我的代码发布到 azure web 应用程序服务,我已经添加了通过创建文件夹来构建 repo 的代码,它是简单的 hello world nodejs 应用程序,它是本地系统中的工作文件,但是当我创建一个新版本我收到这个错误
npm ERR! npm 错误! enoent ENOENT: no such file or directory, open '/home/vsts/work/package.json' enoent ENOENT: 没有那个文件或目录,打开'/home/vsts/work/package.json'
Found npm debug log, make sure the path matches with the one in npm's output: /home/vsts/.npm/_logs/2020-01-20T10_30_12_597Z-debug.log 0 info it worked if it ends with ok 1 verbose cli [ '/opt/hostedtoolcache/node/10.14.1/x64/bin/node', 1 verbose cli '/opt/hostedtoolcache/node/10.14.1/x64/bin/npm', 1 verbose cli 'run', 1 verbose cli 'build', 1 verbose cli '--if-present' ] 2 info using npm@6.4.1 3 info using node@v10.14.1 4 verbose stack Error: ENOENT: no such file or directory, open '/home/vsts/work/package.json' 5 verbose cwd /home/vsts/work/8/s 6 verbose Linux 4.15.0-1064-azure 7 verbose argv "/opt/hostedtoolcache/node/10.14.1/x64/bin/node" "/opt/hostedtoolcache/node/10.14.1/x64/bin/npm" "run" "build" "--if-present" 8 verbose node v10.14.1 9 verbose npm v6.4.1 10 error path /home/vsts/work/package.json 11 error code ENOENT 12 error errno -2 13 error syscall open 14 error enoent ENOENT: no such file or directory, open '/home/vsts/work/package.json' 15 error enoent This is related to n找到 npm 调试日志,确保路径与 npm 输出中的路径匹配:/home/vsts/.npm/_logs/2020-01-20T10_30_12_597Z-debug.log 0 info 如果它以 ok 1 verbose cli [' /opt/hostedtoolcache/node/10.14.1/x64/bin/node', 1 个详细 cli '/opt/hostedtoolcache/node/10.14.1/x64/bin/npm', 1 个详细 cli 'run', 1 个详细 cli 'build', 1 verbose cli '--if-present'] 2 info using npm@6.4.1 3 info using node@v10.14.1 4 verbose stack Error: ENOENT: no such file or directory, open '/home/vsts /work/package.json' 5 详细 cwd /home/vsts/work/8/s 6 详细 Linux 4.15.0-1064-azure 7 详细 argv "/opt/hostedtoolcache/node/10.14.1/x64/bin/node " """/opt/hostedtoolcache/node/10.14.1/x64/bin/npm" "run" "build" "--if-present" 8 详细节点 v10.14.1 9 详细 npm v6.4.1 10 错误路径 /home/ vsts/work/package.json 11 错误代码 ENOENT 12 错误 errno -2 13 错误 syscall open 14 错误 enoent ENOENT: 没有那个文件或目录,打开 '/home/vsts/work/package.json' 15 错误 enoent 这是相关的到 n pm not being able to find a file. pm 无法找到文件。 16 verbose exit [ -2, true ] npm ERR! 16 详细退出 [ -2, true ] npm ERR! A complete log of this run can be found in: npm ERR!可以在以下位置找到此运行的完整日志:npm ERR! /home/vsts/.npm/_logs/2020-01-20T10_30_12_597Z-debug.log ##[error]Error: Npm failed with return code: 254 ##[section]Finishing: Run 'build' script /home/vsts/.npm/_logs/2020-01-20T10_30_12_597Z-debug.log ##[error]错误:Npm失败,返回码:254 ##[section]Finishing:运行'build'脚本
Kindly help in resolving this error.请帮助解决此错误。
您是否在 VSTS 上使用私人代理?
Build failed in azure devops even though package.json file is present in the Repo即使 repo 中存在 package.json 文件,在 azure devops 中构建也失败
First check your path /home/vsts/work/
does this really has package.json
file, if not, then you have to install npm again (command " npm init
") to ensure package.json
file appears in the same directory as mentioned in your error.首先检查你的路径/home/vsts/work/
这是否真的有package.json
文件,如果没有,那么你必须再次安装npm(命令“ npm init
”)以确保package.json
文件出现在提到的同一目录中在你的错误中。
Besides, if you have any package-lock.json
in your repo, try to remove it and run the pipeline again.此外,如果您的存储库中有任何package-lock.json
,请尝试将其删除并再次运行管道。
If above not help you resolve your question, please share your build definition to us.如果以上内容不能帮助您解决问题,请与我们分享您的构建定义。
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.