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

Binary vs NPM .bin #6120

Closed
guyisra opened this issue Jan 8, 2020 · 4 comments
Closed

Binary vs NPM .bin #6120

guyisra opened this issue Jan 8, 2020 · 4 comments

Comments

@guyisra
Copy link

guyisra commented Jan 8, 2020

Doing npm install/yarn on a package.json where cypress exists installs cypress and its binary to the node_modules/.bin folder

But when trying to yarn cypress run it says that the binary is not found/installed and need to do yarn cypress install which then downloads the binary, unzips it and places it in ~/.cache/3.8.1/Cypress

But then when running yarn cypress it outputs

It looks like you are running the Cypress binary directly.
This is not the recommended approach, and Cypress may not work correctly.
Please install the 'cypress' NPM package and follow the instructions here:
https://on.cypress.io/installing-cypress

Can you please clarify why I need both the downloaded binary and the npm binary and when I would use each?

@jennifer-shehane
Copy link
Member

You should only need in include Cypress in your package.json (yarn add cypress) and run yarn (do not run both npm and yarn commands mixed together)

You are not meant to run the binary directly as stated in the error message and instead should just need to run yarn cypress run after a correct install.

Also make sure you have not inadvertently downloaded 2 versions of Cypress #4595 Or if the install got interupted, this may result in an incomplete binary install which can cause this issue. So, clean your node_modules and reinstall.

Run cypress verify to verify a correct installation.

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Jan 8, 2020
@guyisra
Copy link
Author

guyisra commented Jan 8, 2020

thanks, so when would I need the binary version?

@pravynandas
Copy link

Hi @guyisra, If I may answer from my experiences. The cypress npm package is a wrapper for the actual binary which gets installed in ~/.cache in linux and C:\Users<user>\AppData\Local\Cypress\Cache in windows.

But all we need to do for a proper install is 'yarn add cypress' OR 'npm install cypress' which will internally take care of installing the actual binaries to the corresponding cache folders and the npm wrapper binaries to the node_modules/cypress (and node_modules/.bin).

Most probably, as @jennifer-shehane pointed, combining npm and yarn in the same project could have corrupted the installation (simply because they work in their own way when it comes to handling packages installation and operation).

To start fresh, all we need to do is delete node_modules and package-lock.json and do a fresh yarn install (OR) npm install.

@jennifer-shehane
Copy link
Member

Closing as resolved.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@jennifer-shehane jennifer-shehane removed the stage: awaiting response Potential fix was proposed; awaiting response label Jul 7, 2020
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

3 participants