web-dev-qa-db-ja.com

NG NPMエラー134でAzure Pipelinesでビルドが失敗する

ホストされているビルドの約50%がnpmエラー134で失敗しています。ホストされているvs2017を使用して、同じビルド定義で同じコミットをビルドしています。 AngularアプリケーションをAngular CLIを使用して構築しています。npmタスクは、「ng build --prod」として定義されている 'run build'を呼び出します。 package.json。成功したビルドと失敗したビルドの両方で、npmタスクバージョン1.1.49とnpm verion 6.8が使用されています。これにより、ホストされた環境に関連するものであると信じられます。ホストされたvs2017エージェントとvs2019エージェントは、ほとんど常に失敗します。Windowsコンテナエージェントが失敗する時間は約50%です。

npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] build: `ng build --prod`
npm ERR! Exit status 134
npm ERR! 
npm ERR! Failed at the [email protected] 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:\npm\cache\_logs\TimeStampHere-debug.log
Found npm debug log, make sure the path matches with the one in npm's output: C:\npm\cache\_logs\TimeStampHere-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;d:\a\1\s\ngmyapp\node_modules\.bin;C:\agents\2.149.2\externals\git\cmd;C:/hostedtoolcache/windows/Python/3.6.8/x64;C:/hostedtoolcache/windows/Python/3.6.8/x64/Scripts;C:\vcpkg;C:\cf-cli;C:\Program Files (x86)\NSIS\;C:\Program Files\Boost\1.69.0;C:\Users\VssAdministrator\.dotnet\tools;C:\Program Files\dotnet;C:\mysql-5.7.21-winx64\bin;C:\Program Files\Java\zulu-8-Azure-jdk_8.36.0.1-8.0.202-win_x64\bin;C:\npm\prefix;C:\hostedtoolcache\windows\Ruby\2.5.0\x64\bin;C:\Go1.11.5\bin;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Scripts;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64;C:\Program Files\Microsoft MPI\Bin\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Chocolatey\bin;C:\Program Files\Docker;C:\Program Files\PowerShell\6\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;c:\tools\php;C:\Program Files (x86)\Subversion\bin;C:\Program Files\nodejs\;C:\Program Files\CMake\bin;C:\Program Files\Mercurial;C:\Strawberry\c\bin;C:\Strawberry\Perl\site\bin;C:\Strawberry\Perl\bin;C:\Program Files\OpenSSL\bin;C:\Users\VssAdministrator\AppData\Local\Microsoft\WindowsApps;
9 verbose lifecycle [email protected]~build: CWD: d:\a\1\s\ngmyapp
10 silly lifecycle [email protected]~build: Args: [ '/d /s /c', 'ng build --prod' ]
11 silly lifecycle [email protected]~build: Returned: code: 134  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `ng build --prod`
13 verbose stack Exit status 134
13 verbose stack     at EventEmitter.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd d:\a\1\s\myapp
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.15.2
19 verbose npm  v6.8.0
20 error code ELIFECYCLE
21 error errno 134
22 error [email protected] build: `ng build --prod`
22 error Exit status 134
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 134, true ]

##[error]Error: Npm failed with return code: 134
##[section]Finishing: npm build

編集:オンプレミスでビルドエージェントを構成しましたが、問題は発生していません。

4
Calidus

この例では、Jenkinsビルドサーバーを使用していますが、同じエラーが発生します。ビルドの進行状況のログを、progress = falseオプションでオフにして解決しました。

SPAはVisual Studioプロジェクトでホストされているため、*。csprojファイルのビルドコマンドにオプションが追加されます

<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod --progress=false" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod --progress=false" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
0
Neville