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

Cannot install - cache path is possibly incorrect #8093

Closed
bondjimbond opened this issue Jul 27, 2020 · 3 comments
Closed

Cannot install - cache path is possibly incorrect #8093

bondjimbond opened this issue Jul 27, 2020 · 3 comments

Comments

@bondjimbond
Copy link

bondjimbond commented Jul 27, 2020

Current behavior:

same issue that was logged in #1281, but I'm on a fresh install of nodejs.

Attempting sudo npm install -g cypress in RHEL 7:

$ sudo npm install -g cypress
/usr/bin/cypress -> /usr/lib/node_modules/cypress/bin/cypress

> cypress@4.11.0 postinstall /usr/lib/node_modules/cypress
> node index.js --exec install

Cypress cannot write to the cache directory due to file permissions

See discussion and possible solutions at
https://github.com/cypress-io/cypress/issues/1281

----------

Failed to access /root/.cache/Cypress:

EACCES: permission denied, mkdir '/root/.cache/Cypress'

----------

Platform: linux (Red Hat Linux - 7.8)
Cypress Version: 4.11.0
npm ERR! Linux 3.10.0-1062.1.2.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "install" "-g" "cypress"
npm ERR! node v6.17.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! cypress@4.11.0 postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cypress@4.11.0 postinstall script 'node index.js --exec install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the cypress package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js --exec install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cypress
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls cypress
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/html/npm-debug.log

Log:

30249 verbose stack Error: cypress@4.11.0 postinstall: `node index.js --exec install`
30249 verbose stack Exit status 1
30249 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
30249 verbose stack     at emitTwo (events.js:106:13)
30249 verbose stack     at EventEmitter.emit (events.js:191:7)
30249 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
30249 verbose stack     at emitTwo (events.js:106:13)
30249 verbose stack     at ChildProcess.emit (events.js:191:7)
30249 verbose stack     at maybeClose (internal/child_process.js:920:16)
30249 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
30250 verbose pkgid cypress@4.11.0
30251 verbose cwd /var/www/html
30252 error Linux 3.10.0-1062.1.2.el7.x86_64
30253 error argv "/usr/bin/node" "/bin/npm" "install" "-g" "cypress"
30254 error node v6.17.1
30255 error npm  v3.10.10
30256 error code ELIFECYCLE
30257 error cypress@4.11.0 postinstall: `node index.js --exec install`
30257 error Exit status 1
30258 error Failed at the cypress@4.11.0 postinstall script 'node index.js --exec install'.
30258 error Make sure you have the latest version of node.js and npm installed.
30258 error If you do, this is most likely a problem with the cypress package,
30258 error not with npm itself.
30258 error Tell the author that this fails on your system:
30258 error     node index.js --exec install
30258 error You can get information on how to open an issue for this project with:
30258 error     npm bugs cypress
30258 error Or if that isn't available, you can get their info via:
30258 error     npm owner ls cypress
30258 error There is likely additional logging output above.
30259 verbose exit [ 1, true ]

Desired behavior:

Should install.

Observations

The specific error is:

Failed to access /root/.cache/Cypress:

EACCES: permission denied, mkdir '/root/.cache/Cypress'

I note that in #1281, a comment notes that Cypress should be writing to ~/.cache/Cypress, which is the user's directory. It looks like instead of ~, which means /home/root, it's instead writing to an absolute path starting with /root.

Test code to reproduce

On RHEL7, just try to install: sudo npm install -g cypress:

Versions

Cypress: 4.11.0
OS: RHEL 7.8

@jennifer-shehane
Copy link
Member

You should not need to run (and we don't advise) using sudo to install any npm packages - there are a lot of articles online that explain why this is not a good idea. Cypress requires writing to a cache directory, which is currently root for you due to the sudo install.

You should also not need to install cypress globally. We recommend installing per project following the instructions on our docs: https://on.cypress.io/installing-cypress

@bondjimbond
Copy link
Author

Thanks for the clarification. Trying in just the project directory, I'm still having problems. Cypress isn't recognized as installed by my project, so I'm trying to open it as directed. It seems to be stuck on "Opening Cypress" as it's been sitting there with those ellipses for the last 10 minutes. Is there a specific fix known for this?

$ ./node_modules/.bin/cypress open
It looks like this is your first time using Cypress: 4.11.0

  ✔  Verified Cypress! /home/myuser/.cache/Cypress/4.11.0/Cypress

Opening Cypress...

@jennifer-shehane
Copy link
Member

Did you uninstall the global cypress completely?

Could you run Cypress in debug mode mode and print the entire set of logs here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants