简体   繁体   English

使用 Github 发布 React+dotnet 核心应用程序引发错误 MSB3073 的操作:命令“npm run build”退出,代码为 1

[英]Publishing React+dotnet core application using Github Actions throwing error MSB3073: The command “npm run build” exited with code 1

I am getting the below error while publishing the React+dotnet core application using Github Actions.使用 Github 操作发布 React+dotnet 核心应用程序时出现以下错误。 I am using the GitHub self-hosted runners on my windows server 2016.我在我的 windows 服务器 2016 上使用 GitHub 自托管运行器。

npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! ptrx_backoffice@0.1.0 build: `react-scripts build`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the ptrx_backoffice@0.1.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!  
  C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-02-11T15_54_47_880Z-debug.log
D:\aayush\ptrx_backoffice\ptrx_backoffice\PTRX_BackOffice.csproj(49,5): error MSB3073: The command "npm run build" exited with code 1.
Error: Process completed with exit code 1.

Logfile 2021-02-11T15_54_47_880Z-debug.log output is as below.日志文件 2021-02-11T15_54_47_880Z 2021-02-11T15_54_47_880Z-debug.log output 如下。 I have tried deleting node-modules, cleaned cache using npm but it doesn't seem an issue with NPM as it's clearly saying in the logs that this is not related to NPM.我尝试使用 npm 删除节点模块,清理缓存,但 NPM 似乎没有问题,因为它在日志中清楚地表明这与 NPM 无关。 Please let me know if someone can help on it.请让我知道是否有人可以提供帮助。

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.16.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle ptrx_backoffice@0.1.0~prebuild: ptrx_backoffice@0.1.0
6 info lifecycle ptrx_backoffice@0.1.0~build: ptrx_backoffice@0.1.0
7 verbose lifecycle ptrx_backoffice@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle ptrx_backoffice@0.1.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\aayush\ptrx_backoffice\ptrx_backoffice\ClientApp\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\PHP\v7.1;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;C:\Users\Administrator\AppData\Roaming\npm;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Apache24\bin;C:\Users\Administrator\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\PuTTY\;C:\python\Scripts\;C:\python\;C:\Program Files\Scripts\;C:\Program Files\;C:\Users\Administrator\AppData\Roaming\npm;C:\Apache24\bin;C:\Program Files\JetBrains\PyCharm Community Edition 2020.1\bin;;C:\Users\Administrator\.dotnet\tools
9 verbose lifecycle ptrx_backoffice@0.1.0~build: CWD: D:\aayush\ptrx_backoffice\ptrx_backoffice\ClientApp
10 silly lifecycle ptrx_backoffice@0.1.0~build: Args: [ '/d /s /c', 'react-scripts build' ]
11 silly lifecycle ptrx_backoffice@0.1.0~build: Returned: code: 1  signal: null
12 info lifecycle ptrx_backoffice@0.1.0~build: Failed to exec build script
13 verbose stack Error: ptrx_backoffice@0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:321:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:321:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid ptrx_backoffice@0.1.0
15 verbose cwd D:\aayush\ptrx_backoffice\ptrx_backoffice\ClientApp
16 verbose Windows_NT 6.3.9600
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v12.16.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error ptrx_backoffice@0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the ptrx_backoffice@0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

According tho this link:根据这个链接:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/f70c2425-14de-49cf-b228-d29548c9ef87/getting-error-msb3073?forum=msbuild https://social.msdn.microsoft.com/Forums/vstudio/en-US/f70c2425-14de-49cf-b228-d29548c9ef87/getting-error-msb3073?forum=msbuild

You may have a wrong path set somewhere, just to quote the article:您可能在某处设置了错误的路径,只是引用这篇文章:

Generally speaking, the Error MSB3073 is generally caused by an incorrect path in the command line.一般来说,错误MSB3073一般是由于命令行路径不正确造成的。

Now, in your PATH you have, in particular, this value:现在,在您的 PATH 中,您尤其拥有以下值:

D:\aayush\ptrx_backoffice\ptrx_backoffice\ClientApp\node_modules\.bin;

But, and this is where the issue seems to be, you call this command:但是,这似乎是问题所在,您调用此命令:

C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"

It looks that you are trying to execute a binary that does not exists.看起来您正在尝试执行一个不存在的二进制文件。

My feeling is that you are using a development environment variable in your production environment.我的感觉是您在生产环境中使用了开发环境变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 命令“npm run build”以代码 1 退出 - The command "npm run build" exited with code 1 使用 React 构建 ASP.NET Core 应用程序时,如何修复“命令“npm install”退出并显示代码 1”错误? - How to fix 'The command "npm install" exited with code 1' error when building the ASP.NET Core app with React? 构建错误MSB600“tsc.exe”退出代码2 - Build error MSB600 “tsc.exe” exited with code 2 仅使用“ dotnet run”运行“ npm run build” - run “npm run build” with only “dotnet run” ASP.NET 核心 web 应用程序不使用。css styles 使用 do.net 命令运行时 - ASP.NET CORE web application doesn't use .css styles when run using dotnet command 发布 ASP.NET 核心应用程序:命令“npm install”退出,代码为 9009 - Release of ASP.NET core App: The command "npm install" exited with code 9009 运行命令“ dotnet project.dll”时,如何在.net core 1.1中获取正确的应用程序路径? - How to get the right application path in .net core 1.1 when run command “dotnet project.dll”? GitHub 操作无法发布到 Azure - GitHub actions fails publishing to Azure 如何在 ASP.NET Core 中构建之前运行特定的 NPM 命令? - How do I run a specific NPM command before build in ASP.NET Core? dotnet构建抛出nullreference异常 - dotnet build throwing nullreference exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM