简体   繁体   English

即使 repo 中存在 package.json 文件,在 azure devops 中构建也失败

[英]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.

相关问题 在单独的 Azure DevOps 存储库和构建管道中触发 Package 版本更新 - Triggering A Package Version Update In Separate Azure DevOps Repo and Build Pipeline CodeCoverage 结果未显示在 Azure DevOps 中,即使创建了.coverage 文件 - CodeCoverage results not showing in Azure DevOps even though .coverage file is created azure 部署:站点/wwwroot 中没有 package.json 文件 - azure deployment: no package.json file in site/wwwroot Azure devops 管道作业显示成功,即使 Maven 任务失败 - Azure devops pipeline job shows success even though the Maven task is failed 使用 Github Actions 将 Angular 应用程序部署到 Azure 失败。 找不到 package.json - Deploying angular app to Azure with Github Actions failed. package.json not found 如何将存储在 azure devOps 存储库中的 json 文件作为 blob 复制到 azure 存储帐户? - How to copy .json file stored in azure devOps repo to azure storage account as a blob? 更新 Azure DevOps 构建文件 - Update Azure DevOps build file Azure DevOps-发布任务构建失败 - Azure DevOps- Publish task build failed CI/CD 到 Azure AppService 失败并显示 ENOENT:没有这样的文件或目录,打开“/home/site/wwwroot/package.json” - CI/CD to Azure AppService fails with ENOENT: no such file or directory, open '/home/site/wwwroot/package.json' 无法推送到 Azure DevOps git repo - 它没有要求输入用户名 - Failed to push to Azure DevOps git repo - it didn't ask for username
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM