NPM install Not Working on azure pipeline


(Aneesh) #1

Hi,

I am getting the below error in azure CICD pipeline while doing npm install.

Unhandled rejection Error: EACCES: permission denied, mkdir β€˜/home/vsts/.npm/_cacache/index-v5/1c/39’

Unhandled rejection Error: EACCES: permission denied, mkdir β€˜/home/vsts/.npm/_cacache/index-v5/cb/97’

Unhandled rejection Error: EACCES: permission denied, mkdir β€˜/home/vsts/.npm/_cacache/index-v5/4d/9a’

npm http fetch GET 200 https://registry.npmjs.org/@angular/core/-/core-7.2.4.tgz 2318ms

npm http fetch GET 200 https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.0.tgz 37ms

npm http fetch GET 200 https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz 47ms

Unhandled rejection Error: EACCES: permission denied, mkdir β€˜/home/vsts/.npm/_cacache/index-v5/eb/27’

Unhandled rejection Error: EACCES: permission denied, mkdir β€˜/home/vsts/.npm/_cacache/index-v5/8c/17’

npm timing npm Completed in 7681ms

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:

npm ERR! <https://npm.community>

npm ERR! A complete log of this run can be found in:

npm ERR! /home/vsts/.npm/_logs/2019-02-25T05_15_19_901Z-debug.log

Can someone help on this?


(John Gee) #2

Are you using sudo with any global npm installs on the build agent?

I found this mentioned as a possible setup in the docs: https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/javascript?view=azure-devops&tabs=yaml#install-tools-on-your-build-agent

If so, there is a potential issue with npm leaving behind some files owned by root, and the canonical open bug is Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.

A work-around is to reset the ownership before doing normal installs without sudo:

sudo chown -R $(whoami) ~/.npm

(Aneesh) #3

Thank you for the update.
Getting a different error now.

2019-02-25T07:21:22.119863982Z > web-ui@0.0.0 start /home/site/wwwroot
2019-02-25T07:21:22.119873482Z > ng serve
2019-02-25T07:21:22.119881182Z
2019-02-25T07:21:22.624121408Z internal/modules/cjs/loader.js:582
2019-02-25T07:21:22.624184110Z throw err;
2019-02-25T07:21:22.624193210Z ^
2019-02-25T07:21:22.624200610Z
2019-02-25T07:21:22.624208211Z Error: Cannot find module β€˜β€¦/lib/init’
2019-02-25T07:21:22.624216011Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
2019-02-25T07:21:22.624225811Z at Function.Module._load (internal/modules/cjs/loader.js:506:25)
2019-02-25T07:21:22.624236912Z at Module.require (internal/modules/cjs/loader.js:636:17)
2019-02-25T07:21:22.624244412Z at require (internal/modules/cjs/helpers.js:20:18)
2019-02-25T07:21:22.624251712Z at Object. (/home/site/wwwroot/node_modules/.bin/ng:25:1)
2019-02-25T07:21:22.624259613Z at Module._compile (internal/modules/cjs/loader.js:688:30)
2019-02-25T07:21:22.624267013Z at Object.Module._extensions…js (internal/modules/cjs/loader.js:699:10)
2019-02-25T07:21:22.624274313Z at Module.load (internal/modules/cjs/loader.js:598:32)
2019-02-25T07:21:22.624281613Z at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
2019-02-25T07:21:22.624410118Z at Function.Module._load (internal/modules/cjs/loader.js:529:3)
2019-02-25T07:21:22.637892008Z npm ERR! code ELIFECYCLE
2019-02-25T07:21:22.643739221Z npm ERR! errno 1
2019-02-25T07:21:22.645994603Z npm ERR! athena-web-ui@0.0.0 start: ng serve
2019-02-25T07:21:22.653496875Z npm ERR! Exit status 1
2019-02-25T07:21:22.654291804Z npm ERR!
2019-02-25T07:21:22.654974329Z npm ERR! Failed at the athena-web-ui@0.0.0 start script.
2019-02-25T07:21:22.658010839Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-02-25T07:21:22.723400416Z
2019-02-25T07:21:22.733318276Z npm ERR! A complete log of this run can be found in:
2019-02-25T07:21:22.733913298Z npm ERR! /root/.npm/_logs/2019-02-25T07_21_22_683Z-debug.log

2019-02-25 07:21:23.425 ERROR - Container athena-testing_0 for site athena-testing has exited, failing site start
2019-02-25 07:21:23.447 ERROR - Container athena-testing_0 didn’t respond to HTTP pings on port: 4200, failing site start. See container logs for debugging.


Any help is much appreciated.

Thank you


(John Gee) #4

(I don’t have any suggestions for the second error. Hopefully someone else does.)


(system) closed #5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.