'ng' is not recognized as an internal or external command

I am somewhat of a newbie to angular. I am getting TeamCity set-up to build 4 .NET elements of my system and 2 angular. One of the Angular front-end pieces is Angular 1.5 (or older at least) and this builds for me in team city as follows:

 

Node.js plugin

Node.js NPM Runner

run-script build

Where "build" is "gulp build" in my package.json

 

****So that one works...but then I have this second angular project whose "build" is defined by package.json as, "ng build". This is a Angular 6.0 project...newer build scheme. Like I said, I'm new to angular and while I've poked-around in each codebase I'm easily confused by the npm, ng toolchain at this point.

With "build" as "ng build" for this project, my build fails in team city as follows...This works for me from power shell: ng resolves. It's like something is missing from the node.js plugin to team city or I have it configured wrong. Any ideas?

[18:28:49]Checkout directory: C:\TeamCity\buildAgent\work\5ca5392dfea11304
[18:28:49]Updating sources: auto checkout (on agent) (1s)
[18:28:50]Step 1/1: build (Node.js NPM)
[18:28:50][Step 1/1] Executing npm via wrapping shell script
[18:28:50][Step 1/1] Starting: cmd /c npm run-script build
[18:28:50][Step 1/1] in directory: C:\TeamCity\buildAgent\work\5ca5392dfea11304
[18:28:50][Step 1/1] npm run-script build
[18:28:51][npm run-script build]
[18:28:51][npm run-script build] > purchaseswebapp@0.0.0 build C:\TeamCity\buildAgent\work\5ca5392dfea11304
[18:28:51][npm run-script build] > ng build
[18:28:51][npm run-script build]
[18:28:51][npm run-script build] 'ng' is not recognized as an internal or external command,
[18:28:51][npm run-script build] operable program or batch file.
[18:28:51][npm run-script build] npm ERR! code ELIFECYCLE

 

 

 

 

 

 

 

 

0
1 comment

Hi,

 

the "is not recognized as an internal or external command" is a message coming from Windows itself, indicating that it's trying to run the process but cannot find the path to the executable. Builds in teamcity are started from the build agent's process, and thus inherit the build agent's environment. Please make sure that the build agent has the required tools in its PATH environment variable. This will usually require tweaking the user that runs the process and restarting the user session (or the machine).

 

Could you check whether this works for you?

 

 

0

Please sign in to leave a comment.