Reputation: 37
I am working with Azure DevOps CI/CD for Angular 7 project but it is failing with following at the time of building angular code:
Error: Npm failed with return code: 1
Going through the pipeline task log I found that Node is exiting with following error:
2019-05-27T06:57:25.6984762Z npm verb lifecycle [email protected]~build: CWD: D:\a\1\s\Client 2019-05-27T06:57:25.6984945Z npm info lifecycle [email protected]~build: Failed to exec build script 2019-05-27T06:57:25.6985117Z npm verb stack Error: [email protected] build:
node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev "--prod"
2019-05-27T06:57:25.6985258Z npm verb stack Exit status 1 2019-05-27T06:57:25.6985401Z npm verb stack at EventEmitter. (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16) 2019-05-27T06:57:25.6985577Z npm verb stack at EventEmitter.emit (events.js:189:13) 2019-05-27T06:57:25.6985721Z npm verb stack at ChildProcess. (C:\npm\prefix\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 2019-05-27T06:57:25.6986143Z npm verb stack at ChildProcess.emit (events.js:189:13) 2019-05-27T06:57:25.6986311Z npm verb stack at maybeClose (internal/child_process.js:970:16) 2019-05-27T06:57:25.6986453Z npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) 2019-05-27T06:57:25.6986609Z npm verb pkgid [email protected] 2019-05-27T06:57:25.6986743Z npm verb cwd D:\a\1\s\Client 2019-05-27T06:57:25.6986877Z npm verb Windows_NT 10.0.14393 2019-05-27T06:57:25.6987017Z npm verb argv "C:\Program Files\nodejs\node.exe" "C:\npm\prefix\node_modules\npm\bin\npm-cli.js" "run" "build" "--" "--prod" 2019-05-27T06:57:25.6987169Z npm verb node v10.15.3 2019-05-27T06:57:25.6987304Z npm verb npm v6.9.0 2019-05-27T06:57:25.6987435Z npm ERR! code ELIFECYCLE 2019-05-27T06:57:25.6987584Z npm ERR! errno 1 2019-05-27T06:57:25.6987890Z npm ERR! [email protected] build:node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev "--prod"
2019-05-27T06:57:25.6988173Z npm ERR! Exit status 1
I tried looking through different threads based upon error keywords but have not found a fix yet. Please note that everything works fine in the development environment.
I am not allowed to attach file or image so I am pasting pipeline YAML here:
trigger:
- master
pool:
vmImage: 'vs2017-win2016'
steps:
- task: Npm@1
displayName: 'npm install'
inputs:
command: install
workingDir: Client
- task: Npm@1
displayName: 'Build Angular'
inputs:
command: custom
customCommand: run build -- --prod
workingDir: Client
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'angular'
targetPath: 'Client/dist'
Please help.
Upvotes: 2
Views: 3336
Reputation: 37
I was able to get it working after discussion with Microsoft support guys. Here is direct link to solution
Thanks for your support!
Upvotes: -1
Reputation: 152
Your first task must be install Angular CLI.
- task: Npm@1
displayName: angular/cli
inputs:
command: custom
workingDir: Client
verbose: false
customCommand: 'install @angular/cli -g'
Can you try running it to the first step?
Upvotes: 1