Search code examples
node.jsjenkins

Jenkins build issue - npm ERR! Your cache folder contains root-owned files


I am trying to build a small node app on my Jenkins pipeline, which is running in a virtual machine. cross this error:

    + npm install
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm
npm ERR! errno EACCES
npm ERR! 
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR! 
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 111:120 "/.npm"

Running sudo chown -R 111:120 "/.npm" doesn`t help since it says:

chown: cannot access '/.npm': No such file or directory

And, as per my understanding, runs in a local context, when the problem is actually from the container perspective. I`ve tried to add the command above on my Docker and Jenkinsfile as well, to no avail. Below is my public repo:

Node app deploy on github


Solution

  • As far as I can remember ,just updating npm version and deleting the whole project did the trick.