Robert
Robert

Reputation: 4406

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:

Error message enter image description here

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

Upvotes: 3

Views: 4391

Answers (2)

Leo Liu
Leo Liu

Reputation: 76760

Why is ng build failing on azureDevOps?

There is known issue about this issue on the github:

Module build failed error when run ' ng build prod'

And this issue was originally reported a long time ago and since then we've had many releases, one of which might have addressed this problem. Please update to the most recent Angular CLI version.

So, please try to update the Angular CLI version on the agent:

npm uninstall -g angular-cli
npm cache clean or npm cache verify #(if npm > 5)
npm install -g @angular/cli@latest

Check this thread for some more details.

Hope this helps.

Upvotes: 1

Anna
Anna

Reputation: 3256

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: enter image description here

Upvotes: 5

Related Questions