Closed logrox closed 8 months ago
@logrox I can't really track down from the logs that this is an issue with Cypress itself. Does this happen on every install you try of Cypress?
@logrox I can't really track down from the logs that this is an issue with Cypress itself. Does this happen on every install you try of Cypress?
This is what happens every time I install. What's worse, even when creating a new project from scratch, npm init; npm install cypress; Then there is also a problem. Additionally, I only have this problem on the mentioned system. For the Ubuntu version without a graphical environment (production), everything is OK. It is also fine for the Docker version. I have been struggling with this for 2 weeks, if the problem is not solved, I will reinstall the system.
I found a solution to the problem. I had NodeJS installed with Ubuntu Software. I uninstalled and downloaded from https://github.com/nodesource/distributions?tab=readme-ov-file#using-ubuntu.
It remains to determine why Ubuntu Software does not work.
@logrox
You normally do not need to install the source of Node.js (https://github.com/nodesource/distributions?tab=readme-ov-file#using-ubuntu) in order to install Cypress.
In practice it is convenient on Ubuntu to install Node.js with a node-version manager so that you can easily switch between versions for testing. There is a list of these on https://github.com/shadowspawn/node-version-usage. I use n – Interactively Manage Your Node.js Versions on Ubuntu and that is my personal preference.
I experienced the same problem when installing cypress on both pop_os and Ubuntu 24.04 but only when node was installed as a snap. When I installed node using apt the problem was resolved. Seems related to a (lack of) permissions when node is running as a snap.
@zeno-ce
Thanks for your comment about problems installing Cypress when Node.js is installed as a snap package https://github.com/nodejs/snap
I can reproduce this problem.
npm install cypress -D --ignore-scripts
npx cypress install
Generally, Node.js installed via snap is not flexible enough for use with Cypress as it does not allow a choice of which Node.js version to install. At the moment it installs Node.js 20.14.0
which is almost the LTS version.
@MikeMcC399 Thanks for the workaround, you have some control when installing snaps using their channels. For node there are channels from v6 to latest/edge which is currently 23, but latest stable channel is indeed 20.14. I encountered the problem while using channel 18, which was node 18.20.
@zeno-ce
Thanks for filling in my missing know-how on Node.js with snap!
npm install cypress -D --ignore-scripts
npx cypress install
Install Node.js on Ubuntu with nvm according to instructions on https://nodejs.org/en/download/package-manager
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# download and install Node.js (you may need to restart the terminal)
nvm install 20
# verifies the right Node.js version is in the environment
node -v # should print `v20.15.0`
# verifies the right NPM version is in the environment
npm -v # should print `10.7.0`
Another workaround for installing Cypress with snap node (+npm) seems to be
npm install cypress -D --foreground-scripts
Current behavior
Debug logs
Cypress Version
13.6.4
Node version
20.11.0
Package Manager
npm
Package Manager Version
10.4.0
Operating system
Linux
Operating System Version
Ubuntu 22.04.3
Other
64Bit; Gnome:42.9