Open MikeMcC399 opened 1 month ago
I also found that running
npm install cypress --foreground-scripts
is successful, so it is something connected to running an npm lifecycle script in the background using node/npm from snap on Ubuntu.
This issue only affects npm installed via snap node. Using Yarn installed via snap node works correctly.
The following sequence completes successfully:
yarn init -y
yarn add cypress -D
yarn cypress cache list
Also reproducible installing using npm with:
Ubuntu 24.04
LTS
node (22/stable) 22.4.1 from OpenJS Foundation (iojs✓) installed
@rvagg
Will somebody be able to give some feedback on this issue? It may need a warning in the Cypress documentation, but I'd like to understand the root cause first before proposing a documentation update.
snap is one of the recommended node package managers on https://nodejs.org/en/download/package-manager/all
Sorry, I don't have clear advice for you on this one, snaps have trouble doing child process execs because they are already executed in constrained environments; I opt to not use node from a snap if I want to not bump into these problems. I wish I could get to the bottom of it and be able to either provide advice or fix something, but it's not obvious to me where to start digging and I don't have the time or reason to dig deeper, sorry.
@rvagg
Thanks for your valuable feedback and my apologies for pinging you!
I'm going to assume that the problem is inherent to snap and I'll propose a documentation update to Cypress. I don't personally use snap as a package manager for node (I prefer n
& nvm
), but some other Cypress users have hit this issue and I'm trying to make sure that other users won't fall into the same trap.
Issue
Attempting to install the npm module cypress fails at the postinstall stage using npm.
This issue does not occur if Node.js is not installed via snap, for instance via
nvm
.Steps to reproduce
On Ubuntu:
Note: If Cypress has been previously fully installed, then you need to execute the following to delete the Cypress binary from its cache:
or
Environment
Ubuntu
22.04.4
LTS Node.jsv20.14.0 8723 20/stable
installed with snapContinues to be reproducible with
node 20.15.1 8864 20/stable
(bundled npm version10.7.0
)Logs
Install
snap
Workaround
Workaround - split postinstall phase
npx cypress install
is the equivalent ofnode ./node_modules/cypress/index.js --exec install
Workaround - install Node.js with nvm
Install Node.js on Ubuntu with nvm according to instructions on https://nodejs.org/en/download/package-manager