0

Out of a sudden our ng build task in our vsts pipeline does not work any more. The issue first occured only on vsts - when I cleared and reinstalled the node_modules on my machine I could reproduce the issue. Therefore I am pretty sure that the issue comes from package references. Unfortunately the log/error message doesn't give me an idea where to look further:

An unhandled exception occurred: Object prototype may only be an Object or null: undefined
See "C:\Users\Marco\AppData\Local\Temp\ng-bJyhPj\angular-errors.log" for further details.
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! abp-zero-template@6.7.0 publish: `node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod --aot=true`
npm ERR! spawn ENOENT

And this is the content of the angular-errors.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Software\\nodejs\\node.exe',
1 verbose cli   'D:\\node_modules\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'publish' ]
2 info using npm@6.9.0
3 info using node@v10.15.1
4 verbose run-script [ 'prepublish', 'publish', 'postpublish' ]
5 info lifecycle abp-zero-template@6.7.0~prepublish: abp-zero-template@6.7.0
6 info lifecycle abp-zero-template@6.7.0~publish: abp-zero-template@6.7.0
7 verbose lifecycle abp-zero-template@6.7.0~publish: unsafe-perm in lifecycle true
8 verbose lifecycle abp-zero-template@6.7.0~publish: PATH: D:\node_modules\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\enio_git\enio.InvoiceR\enio.InvoiceR.Frontend\node_modules\.bin;D:\enio_git\enio.InvoiceR\enio.InvoiceR.Frontend\node_modules\.bin;C:\Users\Marco\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\192.5728.87\jbr\\bin;C:\Users\Marco\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\192.5728.87\jbr\\bin\server;D:\node_modules;D:\Gradle\bin;C:\SimpleProgs\curl-7.48\bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Users\Marco\.azure-kubectl;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\PROGRA~1\MICROS~4\CLIENT~1\ODBC\130\Tools\Binn\;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;D:\Gradle\bin;C:\SimpleProgs\curl-7.48\bin;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\PROGRA~2\MICROS~3\CLIENT~1\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\PROGRA~2\MICROS~3\130\Tools\Binn\MANAGE~1\;C:\Users\Marco\AppData\Roaming\npm;C:\OpenSSL-Win32\bin;C:\Program Files (x86)\Windows Kits\10\bin\x86;D:\Android\android-sdk\tools;D:\Android\android-sdk\platform-tools;D:\Android\android-sdk\build-tools;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Users\Marco\.azure-kubectl;C:\Program Files\Git\usr\bin;C:\Program Files\heroku\bin;;C:\php7;C:\PROGRA~2\MICROS~2\Azure\CLI2\wbin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WINDOW~1\v1.0\;C:\Program Files (x86)\Common Files\Lenovo;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Users\Marco\AppData\Roaming\npm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Google\Google Apps Sync\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\PROGRA~2\MICROS~3\130\Tools\Binn\;C:\;C:\Program Files (x86)\Yarn\bin\;C:\composer;C:\Program Files\dotnet\;C:\Software\nodejs\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Google\Google Apps Migration\;D:\node_modules;D:\Gradle\bin;C:\SimpleProgs\curl-7.48\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Users\Marco\.azure-kubectl;C:\Program Files\Git\usr\bin;C:\Program Files\heroku\bin;D:\Gradle\bin;C:\Users\Marco\AppData\Roaming\npm;C:\SimpleProgs\curl-7.48\bin;C:\Program Files\Intel\WiFi\bin\;D:\Gradle\bin;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\Program Files (x86)\Common Files\Lenovo;C:\Users\Marco\.azure-kubectl;C:\Program Files\Git\usr\bin;C:\Program Files\heroku\bin;;C:\Program Files (x86)\Sophos\Sophos SSL VPN Client\bin;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\Marco\AppData\Local\Microsoft\WindowsApps;C:\Users\Marco\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\bin\x86;C:\SimpleProgs\curl-7.48\bin;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Users\Marco\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin;C:\Users\Marco\.dnx\bin;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Users\Marco\AppData\Local\Yarn\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Marco\AppData\Roaming\npm;C:\Users\Marco\.dotnet\tools
9 verbose lifecycle abp-zero-template@6.7.0~publish: CWD: D:\enio_git\enio.InvoiceR\enio.InvoiceR.Frontend
10 silly lifecycle abp-zero-template@6.7.0~publish: Args: [ '/d /s /c',
10 silly lifecycle   'node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod --aot=true' ]
11 info lifecycle abp-zero-template@6.7.0~publish: Failed to exec publish script
12 verbose stack Error: abp-zero-template@6.7.0 publish: `node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod --aot=true`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (D:\node_modules\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:189:13)
12 verbose stack     at maybeClose (internal/child_process.js:970:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
13 verbose pkgid abp-zero-template@6.7.0
14 verbose cwd D:\enio_git\enio.InvoiceR\enio.InvoiceR.Frontend
15 verbose Windows_NT 10.0.17134
16 verbose argv "C:\\Software\\nodejs\\node.exe" "D:\\node_modules\\node_modules\\npm\\bin\\npm-cli.js" "run" "publish"
17 verbose node v10.15.1
18 verbose npm  v6.9.0
19 error file C:\WINDOWS\system32\cmd.exe
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error abp-zero-template@6.7.0 publish: `node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build --prod --aot=true`
23 error spawn ENOENT
24 error Failed at the abp-zero-template@6.7.0 publish script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

Has someone an idea where I can look further?

Before I have edited this question it was related to azure pipelines/vsts: Unfortunately I have also no idea how to access the log file mentioned in the exception /tmp/ng-mrMsf6/angular-errors.log - when I download the logs from the vsts build this file won't be included in the zip.

marco birchler
  • 1,566
  • 2
  • 21
  • 45
  • There is so much more information needed for us to be able to help. Like: Does building this also work in a _fresh_ machine (with no previous node modules whatsoever)? Are you sure you don't have any node modules installed locally that you aren't installing on the build agent? Are there updated packages you won't get locally (because the `packages.config` accepts older versions) but that _do_ get installed on the build agent because it doesn't have any old stuff? Have you tried deleting the node modules folder locally, installing packages and running the build? – rickvdbosch Aug 05 '19 at 12:26
  • Are you using a package-lock.json file? Is Azure Pipelines's npm task configured to run `npm install`, or `npm ci` to restore the packages? – jessehouwing Aug 05 '19 at 13:11
  • @rickvdbosch thank you for your comment. And yes indeed after clearing node_modules I have the issue also on my local machine. Therefore I have removed azure pipelines related stuff from the question. – marco birchler Aug 05 '19 at 13:38

1 Answers1

1

To access log files on the Agent, you need to publish them as an artifact. You need configure the Publish Pipeline Artifact to run even on failure:

enter image description here

jessehouwing
  • 106,458
  • 22
  • 256
  • 341