14

When i try to install cypress using this commnad:

sudo npm install cypress

or

sudo npm install -g cypress

It is giving me this error:

Error: EACCES: permission denied, open '/Users/humac/node_modules/cypress/cypress.zip'

user10751590
  • 213
  • 1
  • 4
  • 11
  • Possible duplicate of [Permission denied when installing npm module](https://stackoverflow.com/questions/45520853/permission-denied-when-installing-npm-module) – a_e Mar 13 '19 at 21:57
  • i tried but now getting this error ; Cypress cannot write to the cache directory due to file permissions ---------- Failed to access /Users/humac/Library/Caches/Cypress: EACCES: permission denied, mkdir '/Users/humac/Library/Caches/Cypress' ---------- Platform: darwin (17.7.0) – user10751590 Mar 13 '19 at 22:03

2 Answers2

34

Workaround: sudo npm install --unsafe-perm=true --allow-root cypress

5

In my case cypress had trouble accessing /root/.cache/Cypress upon npm install:

EACCES: permission denied, mkdir '/root/.cache/Cypress'

I found a relevant issue and ended up setting a custom cache dir:

export CYPRESS_CACHE_FOLDER=/app/.cache
npm install
thisismydesign
  • 14,900
  • 8
  • 89
  • 91