简体   繁体   中英

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. I am using the GitHub self-hosted runners on my windows server 2016.

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. 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. 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

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.

Now, in your PATH you have, in particular, this value:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM