1
votes

Below are the Nodejs and Angular CLI version which are running in my windows 10 machine.

Angular CLI: 8.3.5 Node: 10.16.3 OS: win32 x64 Angular: 8.2.7

I have created jenkins job to build Angular Application in my localhost.

Question is here, When i running jenkins job (Freestyle) based project, using this command "C:\Angular>npm install --save-dev @angular/cli@latest && ng v" first install command is working perfectly without any issue, but when its moving to next command "ng v" its throughout the error as like below:

'ng' is not recognized as an internal or external command, operable program or batch file. Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE

Note: But same cmd "npm install --save-dev @angular/cli@latest && ng v" is working as we expected in powershell.

Can you please some help on this.

1
try to have two separated steps . So one with the first command and one with the ng v command . Im guessing the && is causing this issue . This doesnt happen in case of a pipeline but for freestyle you might see it. give it a trymbn217
Hi We have tried to export our ng model path in pipeline script and result is working as expected pipeline stage('Test') { steps { bat 'C:/Angular/node_modules/.bin/ng test --watch=false --code-coverage' } }Anji
Note : without C:/Angular/node_modules/.bin/ this module path it is not working. Can you please suggest how to fix this.Anji
did you actually setup angular in the global configuration in jenkins? If not see this article medium.com/@gustavo.guss/…mbn217
Its working now, after updating global configuration as well.Anji

1 Answers

2
votes

npm command is recognized by default, but "ng" don't, so that you have to write "npm run" before ng command:

npm run ng .....