Q:

Why is ng build failing on azureDevOps?

I am trying to do CI/CD with Azure devops and the below task is failing. 
Here is the package.json file info:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",

Here is the error message:

I have tried removing --prod, creating a custom build argument, and editing the Yaml to manually call ng build

A:

In your environment the following npm and node versions are set:
npm 6.9.0
node 10.16.3

There is an issue, that npm doesn't support this node.js version: https://github.com/nodejs/help/issues/2134.
To fix that you need to add 'Node.js tool installer' task to settle node.js version to supported 8.11.2 (or check which version you use) one, before npm install task in your pipeline: 

