Cypress: macOS High Sierra fails to unzip Cypress on npm or Cypress install

Created on 21 Mar 2018  Â·  18Comments  Â·  Source: cypress-io/cypress

Current behavior:

Upon running npm install cypress -D or cypress install, the "Unzipping Cypress" step fails with a permission denied error.

Additional Info (images, stack traces, etc)

screen shot 2018-03-21 at 9 44 12 am

  • Operating System: macOS High Sierra Version 10.13.3
  • Cypress Version: 2.1.0
  • Browser Version: N/A

Most helpful comment

@cbohatka-cardinal This is 100% a system permission issue. My guess is that you've installed node or npm with sudo. Did any of you install node with nvm? You could try that. It appears you installed a system wide node, which is not recommended.

The error EACCES is coming from node when we try to access the zip that we just downloaded. I don't believe there's anything Cypress can do about it - the binary app and CLI is downloaded 10,000+ times a day on all 3 operating systems so I don't think there's anything that's on our end.

You can try running DEBUG=cypress:* npm install cypress to reinstall the binary and see what happens.

You can also try using version 3.x.x of Cypress since we changed how the binary is cached and installed. I'm going to close this issue as there's no way we can reproduce this since it's too specific to your systems.

All 18 comments

I have verified the folder permissions and owner; I am set to the owner and do have r/w access.

Happens on Sierra 10.12.6 (16G1212) as well.

using [email protected]
using [email protected]

I also tried upgrading npm to no positive effect: brew upgrade nodejs

node v9.9.0
npm  v5.6.0

(got the same error message). Then tried npm install npm@latest -g (so now node v9.9.0 + npm v5.7.1) and tried again... same issue.

Attempting sudo npm install cypress as in this FAQ answer gives the same error (?!).

Worked for me just now:

Mac 10.13.3
Node v9.5.0
NPM v5.6.0

Seeing this issue on, with and without sudo:

Mac 10.13.3
Node v10.3.0
NPM v6.1.0

Any workaround for this?

@filipenevola what worked for me:

CYPRESS_INSTALL_BINARY=0 npm install

then manually download per https://docs.cypress.io/guides/getting-started/installing-cypress.html#Direct-Download and move Cypress.app into node_modules/cypress/dist.

then edit node_modules/cypress/info.json to contain:

{
  "version": "2.1.0",
  "verifiedVersion": "2.1.0"
}

(modify as appropriate for your version)

@cbohatka-cardinal This is 100% a system permission issue. My guess is that you've installed node or npm with sudo. Did any of you install node with nvm? You could try that. It appears you installed a system wide node, which is not recommended.

The error EACCES is coming from node when we try to access the zip that we just downloaded. I don't believe there's anything Cypress can do about it - the binary app and CLI is downloaded 10,000+ times a day on all 3 operating systems so I don't think there's anything that's on our end.

You can try running DEBUG=cypress:* npm install cypress to reinstall the binary and see what happens.

You can also try using version 3.x.x of Cypress since we changed how the binary is cached and installed. I'm going to close this issue as there's no way we can reproduce this since it's too specific to your systems.

Am using NVM - still having the issue (have tried NVM, Brew, and a straight download from Node's site).

If it's any help, I've never been able to install Cypress using npm install directly on this computer. It works if I download then install using the CYPRESS_BINARY_VERSION hack, but only for 2.1.0. Have not been able to get that working on 3.0.1 (even noting the new syntax for passing the binary). Works fine on my Parallels Windows side, so I have a workaround, but frustrating.

Trying to install 2.1.0:

rmt-jkaupert-osx:mosaic-cypress jkaupert$ DEBUG=cypress:* npm install cypress

> [email protected] postinstall /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress
> node index.js --exec install

  cypress:cli installing Cypress from NPM +0ms
  cypress:cli installing with options {} +0ms
  cypress:cli path to info.json file /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress/dist/info.json +0ms
  cypress:cli could not read info file +3ms
  cypress:cli {} +1ms
  cypress:cli installed version is undefined version needed is 2.1.0 +6ms
  cypress:cli path to info.json file /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress/dist/info.json +1ms
  cypress:cli could not read info file +0ms
  cypress:cli path to info.json file /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress/dist/info.json +1ms
  cypress:cli preparing to download and unzip version 2.1.0 +4ms
Installing Cypress (version: 2.1.0)

  cypress:cli need to download Cypress version 2.1.0 +0ms
  cypress:cli checking local file /Users/jkaupert/Documents/mosaic/mosaic-cypress/2.1.0 cwd /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress +0ms
  cypress:cli Downloading from https://download.cypress.io/desktop/2.1.0?platform=darwin&arch=x64 +2ms
  cypress:cli Saving file to /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress/dist/cypress.zip +0ms
 â §  Downloading Cypress      99% 0s
    Unzipping Cypress
    Finishing Installation
  cypress:cli downloading finished +9s
 ✔  Downloaded Cypress
 ✖  Unzipping Cypress
   → Cypress Version: 2.1.0
    Finishing Installation
The Cypress App could not be unzipped.

Search for an existing issue or open a GitHub issue at

https://github.com/cypress-io/cypress/issues
----------

Error: EACCES: permission denied, open '/Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress/dist/cypress.zip'
----------

Platform: darwin (17.4.0)
Cypress Version: 2.1.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jkaupert/.npm/_logs/2018-06-11T19_15_23_781Z-debug.log

Trying to install 3.0.1:

rmt-jkaupert-osx:mosaic-cypress jkaupert$ DEBUG=cypress:* npm install [email protected]

> [email protected] postinstall /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress
> node index.js --exec install

  cypress:cli installing Cypress from NPM +0ms
  cypress:cli installing with options {} +0ms
  cypress:cli version in package.json is 3.0.1 +0ms
  cypress:cli no binary installed under cli version +4ms
  cypress:cli checking local file /Users/jkaupert/Documents/mosaic/mosaic-cypress/3.0.1 cwd /Users/jkaupert/Documents/mosaic/mosaic-cypress/node_modules/cypress +0ms
  cypress:cli preparing to download and unzip version  3.0.1 to path /Users/jkaupert/Library/Caches/Cypress/3.0.1 +1ms
Installing Cypress (version: 3.0.1)

  cypress:cli needed Cypress version: 3.0.1 +0ms
  cypress:cli downloading cypress.zip to "/var/folders/60/d6_k5y6j6xq5kkz33zddqk14r1ms_8/T/cypress.zip" +0ms
  cypress:cli Downloading from https://download.cypress.io/desktop/3.0.1?platform=darwin&arch=x64 +1ms
  cypress:cli Saving file to /var/folders/60/d6_k5y6j6xq5kkz33zddqk14r1ms_8/T/cypress.zip +0ms
 â ¸  Downloading Cypress
 â ¼  Downloading Cypress      99% 0s
    Unzipping Cypress
    Finishing Installation
  cypress:cli downloading finished +9s
  cypress:cli finished downloading file: /var/folders/60/d6_k5y6j6xq5kkz33zddqk14r1ms_8/T/cypress.zip +10s
 ✔  Downloaded Cypress
 ✖  Unzipping Cypress
   → Cypress Version: 3.0.1
    Finishing Installation
The Cypress App could not be unzipped.

Search for an existing issue or open a GitHub issue at

https://github.com/cypress-io/cypress/issues
----------

Error: EACCES: permission denied, open '/var/folders/60/d6_k5y6j6xq5kkz33zddqk14r1ms_8/T/cypress.zip'
----------

Platform: darwin (17.4.0)
Cypress Version: 3.0.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jkaupert/.npm/_logs/2018-06-11T19_16_08_781Z-debug.log

None of those logs indicate you're using NVM. It looks like a system installed node.

Perhaps this is something else entirely - do you have something installed in OSX that's security related? For instance, maybe you have something that prevents .zip files from being accessed when they are downloaded from the internet?

My guess is that since it works in Windows there has to be something at the system level in OSX causing this OR it's a problem installing node. You've made it clear that you've tried installing node all kinds of ways without making a difference... so I'm leaning towards the other potential problem.

Can you check your security + privacy settings in OSX and see if maybe something is aggressively turned on there?

This is what I see for my node and npm locations:

rmt-jkaupert-osx:cypress-test-install jkaupert$ which node
/Users/jkaupert/.nvm/versions/node/v10.3.0/bin/node
rmt-jkaupert-osx:cypress-test-install jkaupert$ which npm
/Users/jkaupert/.nvm/versions/node/v10.3.0/bin/npm

I have done a lot of uninstalling / reinstalling of node trying to solve this problem, but each time before trying a new reinstall have gotten to the point of making sure that a which node and which npm come up with nothing. I'll try to dig into making sure there's no other hidden node/npm remnants from past installs again though (and would prefer to keep NVM).

I don't see anything immediately in Security & Privacy (from CMD+Spacebar) that would look aggressive or problematic (All Downloads allowed). I'm inquiring further with our Mac support guy to see if there's anything ZIP-related he can think of and will report back.

The error I got was

The Cypress App could not be unzipped.
Search for an existing issue or open a GitHub issue at https://github.com/cypress-io/cypress/issues
Error: EACCES: permission denied, open '/var/folders/55/0jxw37m90fnfqstyt4pzr1n80000gp/T/cypress.zip'
Platform: darwin (17.7.0)
Cypress Version: 3.0.2

This is after I uninstalled all global versions of Node/NPM and re-installed them using NVM.

I checked the folder for the cypress.zip file named T, and it seems it has an extended attribute com.apple.rootless which has to do with Apple's System Integrity Protection.

$ xattr T
com.apple.rootless

I suspect this is what's preventing Cypress/NPM from automatically unzipping the file. Is there a way for Cypress to download the file into another folder which doesn't have the rootless attribute?

Just realised that the install works after I disabled my antivirus software... you may wish to try this too

I was having the same issue, but it got fixed after I ran npm install npm@latest -g

Note that I had already installed latest npm earlier today but with a different command.

Running to same issue,
Using latest node with nvm

Mac High Sierra

@midori0507 I used the workaround mentioned here and it worked for me.
https://stackoverflow.com/questions/55151786/getting-error-eacces-permission-denied-when-i-install-cypress

Use this commnad:

sudo npm install --unsafe-perm=true --allow-root

I realize this issue quite stale, but I think people are getting here by searching for "cypress permissions sudo root" or similar.

I had cypress reporting errors that node, cypress or something was installed with sudo on trying npx cypress open. I'd get an error directing me to ~/USERNAME/Library/Caches/Cypress/ or similar. I had cypress in there all the way back to version 3. Deleting the /Cypress directory in ~/USERNAME/Library/Caches/ and reinstalling according the cypress docs solved it.

I highly recommend not installing node or node modules using sudo. It can lead to further unexpected behavior.

@conoverm You can clear Cypress cache by running cypress cache clear https://on.cypress.io/command-line#cypress-cache-clear

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dkreft picture dkreft  Â·  3Comments

jennifer-shehane picture jennifer-shehane  Â·  3Comments

zbigniewkalinowski picture zbigniewkalinowski  Â·  3Comments

Francismb picture Francismb  Â·  3Comments

brian-mann picture brian-mann  Â·  3Comments