Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 949
Fylix Avatar asked Dec 01 '22 13:12

Fylix


2 Answers

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.

like image 142
Matt Avatar answered Dec 09 '22 10:12

Matt


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

- task: NodeTool@0
  inputs:
    versionSpec: '12.x' 
like image 34
Grimace of Despair Avatar answered Dec 09 '22 11:12

Grimace of Despair