skip to Main Content

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


  1. Before running npm ci try either one of the command:

    sudo npm cache clean --force //forcefully remove any npm folder before install
    OR
    sudo chown -R 501:20 "/.npm" //suggested by jenkins
    
    Login or Signup to reply.
  2. 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 is 8.92.2. Follow the commands:

    sudo npm i -g [email protected] && sudo npm i -g npx --force && sudo npx create-react-app app-name
    

    I hope it will work, as it did in my case.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search