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

npm i -D cypress fails with error #29204

Closed
Mlocik97 opened this issue Mar 27, 2024 · 12 comments
Closed

npm i -D cypress fails with error #29204

Mlocik97 opened this issue Mar 27, 2024 · 12 comments
Labels
topic: installation Issue during installation or downloading Cypress

Comments

@Mlocik97
Copy link

Mlocik97 commented Mar 27, 2024

Current behavior

mlocik97@mlocik97-G5-5590:/mnt/sda1/Programovanie/RecipeSearch$  npm install cypress --save-dev
npm ERR! code 1
npm ERR! path /mnt/sda1/Programovanie/RecipeSearch/node_modules/cypress
npm ERR! command failed
npm ERR! command sh -c node index.js --exec install

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mlocik97/.npm/_logs/2024-03-27T13_30_58_204Z-debug-0.log

Debug logs

865 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 708ms
866 timing auditReport:getReport Completed in 721ms
867 silly audit report {}
868 timing auditReport:init Completed in 0ms
869 timing reify:audit Completed in 722ms
870 timing reifyNode:node_modules/dayjs Completed in 706ms
871 timing reifyNode:node_modules/cypress Completed in 861ms
872 timing reifyNode:node_modules/rxjs Completed in 1203ms
873 timing reify:unpack Completed in 1212ms
874 timing reify:unretire Completed in 0ms
875 timing build:queue Completed in 5ms
876 timing build:link:node_modules/cypress Completed in 2ms
877 timing build:link:node_modules/extract-zip Completed in 1ms
878 timing build:link:node_modules/is-ci Completed in 1ms
879 timing build:link:node_modules/sshpk Completed in 1ms
880 timing build:link:node_modules/uuid Completed in 1ms
881 timing build:link Completed in 2ms
882 info run [email protected] postinstall node_modules/cypress node index.js --exec install
883 info run [email protected] postinstall { code: 1, signal: null }
884 timing reify:rollback:createSparse Completed in 248ms
885 timing reify:rollback:retireShallow Completed in 0ms
886 timing command:install Completed in 4119ms
887 verbose stack Error: command failed
887 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
887 verbose stack     at ChildProcess.emit (node:events:517:28)
887 verbose stack     at maybeClose (node:internal/child_process:1098:16)
887 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
888 verbose pkgid [email protected]

Cypress Version

@latest

Node version

v18.19.1

Package Manager

npm

Package Manager Version

8.3.0

Operating system

Linux

Operating System Version

Ubuntu 20.04.6 LTS

Other

No response

@Mlocik97 Mlocik97 added the topic: installation Issue during installation or downloading Cypress label Mar 27, 2024
@jennifer-shehane
Copy link
Member

@Mlocik97 This appears to be an issue with npm installing. I'm not sure what we could do in this situation. Maybe try updating npm?

@jennifer-shehane jennifer-shehane added the stage: awaiting response Potential fix was proposed; awaiting response label Mar 27, 2024
@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Mar 27, 2024

@Mlocik97

Your log is showing a failure installing the Cypress binary for [email protected].

Node.js v18.19.1 automatically includes npm 10.2.4, not 8.3.0.

Please check your version of npm:

npm --version

You may also want to install the latest Node.js 18.x version. which is Node.js v18.20.0 with npm 10.5.0.

The following command works without any issue on Ubuntu 20.04.06 LTS with Node.js v18.19.1 on my test environment.

npm install cypress --save-dev

You can get additional debug information if you split the installation into Cypress npm module and Cypress binary in two steps:

npm install cypress@latest --save-dev --ignore-scripts
export DEBUG=cypress:*
npx cypress install

@Mlocik97
Copy link
Author

Snímka obrazovky z 2024-03-28 17-08-09

Fails even with newer version of NPM....

But when I used --ignore-scripts and then executed npx cypress install, I didn't got any error:

mlocik97@mlocik97-G5-5590:/mnt/sda1/Programovanie/RecipeSearch$  npx cypress install
  cypress:cli:cli cli starts with arguments ["/snap/node/8439/bin/node","/mnt/sda1/Programovanie/RecipeSearch/node_modules/.bin/cypress","install"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli:cli program parsing arguments +2ms
  cypress:cli parsed cli options {} +186ms
  cypress:cli installing with options {} +0ms
  cypress:cli detecting arch { osPlatform: 'linux', osArch: 'x64' } +1ms
  cypress:cli arm uname -m result: { stdout: 'x86_64' }  +16ms
  cypress:cli version in package.json is 13.7.1, version to install is 13.7.1 +16ms
  cypress:cli Reading binary package.json from: /home/mlocik97/.cache/Cypress/13.7.1/Cypress/resources/app/package.json +0ms
  cypress:cli no binary installed under cli version +13ms
  cypress:cli checking local file /mnt/sda1/13.7.1 cwd /mnt/sda1/Programovanie/RecipeSearch +0ms
  cypress:cli preparing to download and unzip version  13.7.1 to path /home/mlocik97/.cache/Cypress/13.7.1 +0ms
Installing Cypress (version: 13.7.1)


  cypress:cli needed Cypress version: 13.7.1 +0ms
  cypress:cli source url https://download.cypress.io/desktop/13.7.1?platform=linux&arch=x64 +0ms
  cypress:cli downloading cypress.zip to "/tmp/cypress-486307.zip" +0ms
  cypress:cli Downloading package {
  url: 'https://download.cypress.io/desktop/13.7.1?platform=linux&arch=x64',
  proxy: null,
  downloadDestination: '/tmp/cypress-486307.zip'
} +2ms
  cypress:cli expected file size 81 +622ms
  cypress:cli redirect version: 13.7.1 +0ms
  cypress:cli redirect url: https://cdn.cypress.io/desktop/13.7.1/linux-x64/cypress.zip +0ms
  cypress:cli Downloading package {
  url: 'https://cdn.cypress.io/desktop/13.7.1/linux-x64/cypress.zip',
  proxy: null,
  downloadDestination: '/tmp/cypress-486307.zip'
} +0ms
  cypress:cli expected checksum d3053a18ab9bc22dfd0caeb0f7a159beb65ca36e2a329f1ff17b80a5b696368ec39350830a942a03bbd06179991eabe25145454bf057ceb1ce45df0aa03d6a05 +204ms
⠏  Downloading Cypress      100% 0s
  cypress:cli downloading finished +8s
⠼  Downloading Cypress      100% 0s
  cypress:cli downloaded file has the expected checksum and size ✅ +523ms
  cypress:cli verified +0ms
✔  Downloaded Cypress
  cypress:cli:unzip unzipping from /tmp/cypress-486307.zip +0ms
  cypress:cli:unzip into /home/mlocik97/.cache/Cypress/13.7.1 +0ms
  cypress:cli:unzip zipFile entries count 22093 +5ms
✔  Downloaded Cypress
✔  Downloaded Cypress
✔  Downloaded Cypress
✔  Unzipped Cypress
✔  Downloaded Cypress
✔  Unzipped Cypress
✔  Finished Installation /home/mlocik97/.cache/Cypress/13.7.1

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

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

@MikeMcC399
Copy link
Contributor

@Mlocik97

Do you want to close this issue now that you have Cypress installed?

It's possible that your previous installation attempt of Cypress with mismatched Node.js / npm versions could have left a partially installed version of Cypress which could not recover without deleting the intermediate contents.

@stephensrmmartin
Copy link

I am also having this problem.
I am building https://github.com/open-webui/open-webui (which I have done many times now, I am just upgrading to latest commits):

Ubuntu: 22.04.3 LTS
Node: v20.13.1
Npm: 10.5.2

Here is the install log (and error):

844 info run [email protected] postinstall { code: 0, signal: null }
845 timing build:run:postinstall:node_modules/svelte-preprocess Completed in 22ms
846 info run [email protected] postinstall node_modules/vite/node_modules/esbuild node install.js
847 info run [email protected] postinstall { code: 0, signal: null }
848 timing build:run:postinstall:node_modules/vite/node_modules/esbuild Completed in 185ms
849 info run [email protected] postinstall { code: 1, signal: null }
850 info run @sveltejs/[email protected] postinstall { code: 0, signal: null }
851 timing build:run:postinstall:node_modules/@sveltejs/kit Completed in 1538ms
852 timing reify:rollback:createSparse Completed in 837ms
853 timing reify:rollback:retireShallow Completed in 0ms
854 timing command:install Completed in 6550ms
855 verbose stack Error: command failed
855 verbose stack     at ChildProcess.<anonymous> (/snap/node/8649/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
855 verbose stack     at ChildProcess.emit (node:events:519:28)
855 verbose stack     at maybeClose (node:internal/child_process:1105:16)
855 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
856 verbose pkgid [email protected]
857 verbose cwd /home/ubuntu/Builds/open-webui
858 verbose Linux 6.5.0-1014-aws
859 verbose node v20.13.1
860 verbose npm  v10.5.2
861 error code 1
862 error path /home/ubuntu/Builds/open-webui/node_modules/cypress
863 error command failed
864 error command sh -c node index.js --exec install
865 verbose exit 1
866 timing npm Completed in 6889ms
867 verbose unfinished npm timer reify 1715622554381
868 verbose unfinished npm timer reify:build 1715622559142
869 verbose unfinished npm timer build 1715622559143
870 verbose unfinished npm timer build:deps 1715622559144
871 verbose unfinished npm timer build:run:postinstall 1715622559189
872 verbose unfinished npm timer build:run:postinstall:node_modules/cypress 1715622559209
873 verbose code 1
874 error A complete log of this run can be found in: /home/ubuntu/.npm/_logs/2024-05-13T17_49_14_043Z-debug-0.log

@MikeMcC399
Copy link
Contributor

@stephensrmmartin

You could try:

npx cypress cache clear
npm ci --foreground-scripts
npx cypress verify

If that doesn't work, I suggest you open a new issue as your issue concerns a different environment.

@stephensrmmartin
Copy link

stephensrmmartin commented May 13, 2024

Yarn, for some reason, worked fine.

Your code produces the more likely reason (?): Apparently Xvfb was not installed.

Edit: Yep, that was it. Xvfb wasn't installed; npm works fine now. Thank you.

@MikeMcC399
Copy link
Contributor

@stephensrmmartin

Yarn, for some reason, worked fine.

Your code produces the more likely reason (?): Apparently Xvfb was not installed.

Edit: Yep, that was it. Xvfb wasn't installed; npm works fine now. Thank you.

You had two different problems and to find out the original reason you would have needed to run with export DEBUG=cypress:* executed. Since it is now working that would probably be difficult to reproduce. A missing Xvfb would not normally prevent Cypress installing. That issue kicks in later.

Good to hear that it's now working anyway. 👍🏻

@MikeMcC399
Copy link
Contributor

This issue should be closed as the original poster already confirmed that their installation was successful.

@jennifer-shehane jennifer-shehane closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
@jennifer-shehane jennifer-shehane removed the stage: awaiting response Potential fix was proposed; awaiting response label May 20, 2024
@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jul 10, 2024

@stephensrmmartin

In the meantime it has surfaced that installing Cypress fails using npm on Ubuntu, when Node.js has been installed using snap.

You can work around this with

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

I would however suggest to avoid snap and use one of the (other) package managers listed by Node.js.

@Mlocik97
Copy link
Author

Mlocik97 commented Jul 10, 2024

Oh, good to know that... I installed node.js via snap, so I guess that's it. Btw. Snap is listed in that package managers list you sent. Also I had issues installing it from nodesource as .deb. For some reason I either had conflict or only node 8 worked, which is too old and unsupported by most frameworks.

@MikeMcC399
Copy link
Contributor

@Mlocik97

Snap is listed in that package managers list you sent.

Thanks for pointing that out! I added "(other)" into my sentence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: installation Issue during installation or downloading Cypress
Projects
None yet
Development

No branches or pull requests

4 participants