I’m using jenkins for execute test cases based on cypress. I’m using kitchen sink example that provide by cypress in github repo https://github.com/cypress-io/cypress-example-kitchensink/blob/master/Jenkinsfile
But when i execute this in jenkins job i got error
npm ci
npm WARN prepare removing existing node_modules/ before installation
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm
npm ERR! errno -13
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 501:20 "/.npm"
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm
npm ERR! errno -13
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 501:20 "/.npm"
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm
npm ERR! errno -13
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 501:20 "/.npm"
npm ERR! code EACCES
For extra information :
Jenkins installed in my MAC OS and running in port 8080 ( default port ) and node js also installed in my local system with version 17.5.0
But dockerfile using in above repo example using cypress image in docker and install related dependency in container
2
Answers
Before running
npm ci
try either one of the command:This can’t be solved by any of the ways formulated in different answers. Only solution I have found is just by avoiding it by changing npm version. Current release of npm is
9.0.1
while the latest version is8.92.2
. Follow the commands:I hope it will work, as it did in my case.