How to solve the error 'Npm failed with return code: 1' in Azure DevOps Pipelines
We had been getting an error Azure DevOps when trying to run our build pipelines. They were working previously without any issues.
We tracked down the cause of the problem and found a fix for it. We thought it would be useful to share this in case you are also experiencing this problem.
The error
The error started to appear when we were running our Build Pipelines in Azure. It looks like this:
What is causing the error?
The reason we had this error is because we hadn't specified a particular version of node to use with our Pipeline npm tasks and when Azure DevOps updated automatically to use version 8 it broke our build pipelines.
Finding the correct version of node to use
When we looked back through the logs of our build pipeline we could see that it was using node version 6.14.15
Fixing the error
The fix for the error was pretty simple. We just needed to go to our build pipeline, click on edit...
Then we needed to add these lines in which specified the correct version to use.
It turns out 6.14.15 isn't available anymore so it had to be 6.14.4
Run it again Sam....uel
With the Azure Pipeline .yml file updated, we were able to run the pipeline again and it just worked like before.
Get in touch
Here at Moriyama, we specialise in developing and supporting Umbraco sites hosted in Azure. If you need any support with your projects or hosting then please get in touch with us using the contact form below: