ng is not recognised as an internal or external command. Jenkins + Angular CLI

No need to install angular cli on server, just run

npm run ng -- build 

That will run the local version from your project devDependencies

This way you can pass any flag to your local cli npm run ng -- test, npm run ng -- lint, etc

You can pass additional flags to ng just like that
run ng -- build --prod

More details at https://docs.npmjs.com/cli/run-script


Just for further clarification when someone searches for the same problem and finds this question (as I did):

If you want to use the --prod flag while running the build command, as asked in this question, you can use:

npm run ng -- build --prod

Important are the "--" between "ng" and "build" with spacing. This is due to the syntax of "npm run", more information can be found here: https://docs.npmjs.com/cli/run-script

This also solves the problem described in a comment below the accepted answer: "This is working but its excluding the additional parameters like --test when running the build"