Fylix
Fylix

Reputation: 2713

Azure DevOps failing on "npm install"

We have a CD/CI Azure DevOps build pipeline that stop working all of a sudden today. It has been invoked successfully in our pipeline for months on end.

The component that fails is the "npm install" , it fails with the following error in the verbose log:

enter image description here

I google around and some suggested to run: npm cache clear --force prior to npm install. I tried that but same error persists.

Then I look up earlier in the log and see the following:

enter image description here

I tried to browse to https://github.com/sass/node-sass/releases/download/v4.12.0/win32-x64-83_binding.node and got the message "Page not found".

I cannot tell if this is related to the root cause why npm fails but it seems to back my assumption that something is not right with "npm install" as of this time of writing (Nov 17, 2020).

Anyone else using Azure DevOps for CD/CI having the same issue? I look at NPM incident page and see this issue https://status.npmjs.org/incidents/r1tlhscrw3r6 but it should have been fixed.

Upvotes: 11

Views: 20928

Answers (3)

David Yates
David Yates

Reputation: 2230

For anyone still using the graphical UI rather than YML files, you would add a "Node.js tool installer" task and configure its version. It would look something like this (where the Version Spec contains the version of node.js you want run): enter image description here Also note that it is BEFORE the "npm install" task!!

Upvotes: 10

Grimace of Despair
Grimace of Despair

Reputation: 3506

Based on @Matt's answer, I'll post the fragment of yml you need to fix this:

- task: NodeTool@0
  inputs:
    versionSpec: '12.x' 

Upvotes: 10

Matt
Matt

Reputation: 4065

Recently, a breaking change was made to the default Azure DevOps agent images for the default version of Node.js. It was incremented from 12.x to 14.x.

Breaking changes

Default version of Node.JS on images will be updated from 12.x to 14.x

Target date

For Windows, Ubuntu images, rollout of this change will start on 2 November 2020 and will take 3-4 days For MacOS images, rollout will start on 9 November.

The motivation for the changes

On images, we always install LTS version of Node.JS by default. On 2020-10-27, Node.JS 14 has become LTS version. On 2020-11-30, Node.JS 12 will be switched to Maintenance mode.

Possible impact

If you rely on default Node.JS version and your project is not compatible to Node.JS 14, it might start to fail

Mitigation ways

Please consider using Node.js Tool Installer task (for Azure DevOps) and setup-node (for GitHub Actions) to switch back to Node.JS 12. Switching will take less than a second. Node.JS 12 still will be available on images along with Node.JS 8, 10.

Upvotes: 11

Related Questions