skip to Main Content

My Azure pipeline started to fail. My error is at follows:

Node.js version v16.20.2 detected.
The Angular CLI requires a minimum Node.js version of v18.13.

I didnt change anything. This is part of my pipeline:

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '16.x'
  displayName: 'Install Node.js'

- script: |
    sudo npm install -g @angular/cli
    npm install
    ng build -c=release --output-path=web/wwwroot
  displayName: 'npm install and build'

Two weeks ago that script works.

My question is, how to fix it in Azure pipelines? I am using Microsoft hosted agents

2

Answers


  1. Can you try changing,

    From

    sudo npm install -g @angular/cli
    

    To

    sudo npm install -g @angular/cli npm@latest
    
    Login or Signup to reply.
  2. I can reproduce the same issue with the same YAML Pipeline.

    enter image description here

    The cause of the issue is that the command: npm install -g @angular/cli will download the latest angular cli package by default.

    The latest Angular CLI version 17.0.0 requests the node version 18.13.

    To solve this issue, you can downgrade the angular CLI version in Azure Pipeline.

    For example: npm install -g @angular/[email protected]

    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '16.x'
      displayName: 'Install Node.js'
    
    - script: |
        npm install -g @angular/[email protected]
        npm install
        ng build --prod
      displayName: 'npm install and build'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search