Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress npm install with snap Node.js on Ubuntu fails to install Cypress binary #5868

Closed
MikeMcC399 opened this issue Jul 9, 2024 · 5 comments · Fixed by #5869
Closed

Cypress npm install with snap Node.js on Ubuntu fails to install Cypress binary #5868

MikeMcC399 opened this issue Jul 9, 2024 · 5 comments · Fixed by #5869

Comments

@MikeMcC399
Copy link
Contributor

Subject

Guides https://docs.cypress.io/guides/getting-started/installing-cypress#npm-install

Description

If an attempt is made to install Cypress on Ubuntu using npm that has been installed via snap Node.js, then it fails to install the Cypress binary.

For example:

sudo snap install node --classic --channel=20
npm install cypress --save-dev

Typical log lines include output similar to the following:

npm info run [email protected] postinstall node_modules/cypress node index.js --exec install
npm info run [email protected] postinstall { code: 1, signal: null }
...
npm error command sh -c node index.js --exec install

If this is an on-going restriction, then it may need to be documented here. A workaround is to use:

npm install cypress --save-dev --foreground-scripts

Yarn is not affected. The following works correctly:

yarn add cypress -D
@jennifer-shehane
Copy link
Member

Sounds fine to document for now.

@MikeMcC399
Copy link
Contributor Author

@jennifer-shehane

Sounds fine to document for now.

It will be a while until I get around to this. I hope there will be some feedback soon from the Node.js snap folks to understand the root cause and who could fix it. For the moment I just wanted to document the issue so there is a place to add any new facts.

@MikeMcC399

This comment was marked as outdated.

@MikeMcC399
Copy link
Contributor Author

Workaround Verification

Ubuntu 22.04.4 LTS

snap install node --classic --channel=20
echo node version $(node -v)
echo npm version $(npm -v)
rm -rf ~/.cache/Cypress
mkdir cy-snap-test
cd cy-snap-test
npm install cypress --save-dev --foreground-scripts
npx cypress verify

Log

$ snap install node --classic --channel=20
echo node version $(node -v)
echo npm version $(npm -v)
rm -rf ~/.cache/Cypress
mkdir cy-snap-test
cd cy-snap-test
npm install cypress --save-dev --foreground-scripts
npx cypress verify
node (20/stable) 20.15.1 from OpenJS Foundation (iojs✓) installed
node version v20.15.1
npm version 10.7.0

> [email protected] postinstall
> node index.js --exec install

Installing Cypress (version: 13.13.0)

✔  Downloaded Cypress
✔  Unzipped Cypress
✔  Finished Installation /home/mike/.cache/Cypress/13.13.0

You can now open Cypress by running: node_modules/.bin/cypress open

https://on.cypress.io/installing-cypress


added 173 packages in 37s

39 packages are looking for funding
  run `npm fund` for details

✔  Verified Cypress! /home/mike/.cache/Cypress/13.13.0/Cypress

@MikeMcC399
Copy link
Contributor Author

@jennifer-shehane

Sounds fine to document for now.

There wasn't any indication that the snap folks would look at resolving the Cypress installation issue in this environment, so there is no timeline at all for a resolution. It therefore makes sense to document the workaround.

petrutlucian94 added a commit to petrutlucian94/harbor-rocks that referenced this issue Jul 17, 2024
On Ubuntu 22.04 with snap installed nodejs, one of the portal
dependencies fails to install:

cypress-io/cypress-documentation#5868

We'll apply the recommended workaround.
aznashwan pushed a commit to aznashwan/harbor-rocks that referenced this issue Jul 17, 2024
On Ubuntu 22.04 with snap installed nodejs, one of the portal
dependencies fails to install:

cypress-io/cypress-documentation#5868

We'll apply the recommended workaround.
aznashwan pushed a commit to aznashwan/harbor-rocks that referenced this issue Jul 19, 2024
On Ubuntu 22.04 with snap installed nodejs, one of the portal
dependencies fails to install:

cypress-io/cypress-documentation#5868

We'll apply the recommended workaround.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants