fypnlp
fypnlp

Reputation: 1547

Cypress cannot run because this binary file does not have executable permissions

I was trying to create a new project in cypress and I got the following strange error message.

Steps:

  1. npm init -y
  2. npm install cypress --save-dev
  3. npx open cypress

I got the following message from my console:

Cypress cannot run because this binary file does not have executable permissions here:

/Users/myName/Library/Caches/Cypress/7.5.0/Cypress.app/Contents/MacOS/Cypress

Reasons this may happen:

  • node was installed as 'root' or with 'sudo'
  • the cypress npm package as 'root' or with 'sudo'

Please check that you have the appropriate user permissions.

You can also try clearing the cache with 'cypress cache clear' and reinstalling.


Platform: darwin (20.5.0) Cypress Version: 7.5.0

How do I fix this?

Upvotes: 1

Views: 6881

Answers (5)

Suman Parajuli
Suman Parajuli

Reputation: 61

Navigate to the cache directory by running the command

cd /Users/myName/Library/Caches/

Here you have to delete the Cypress directory completely by running the command

rm -rf Cypress

Now head over to your project directory and run the command

npx install cypress

Then Cypress will be installed in your system once again. Next time you won't get any errors.

Upvotes: 1

NatesCode
NatesCode

Reputation: 403

Give Cypress the executable permission

chmod +x /Users/myName/Library/Caches/Cypress

You may have to then npx cypress install if it says it isn't installed.

Upvotes: 0

bhav
bhav

Reputation: 11

If you are downloading and installing cypress manually using zip file, Make sure you download the correct version of cypress for right operating system using options

for example https://download.cypress.io/desktop/3.8.3?platform=linux

for more information refer to

https://docs.cypress.io/guides/references/advanced-installation#Run-binary

Upvotes: 0

fypnlp
fypnlp

Reputation: 1547

So, I had a chat with the dev team at Cypress and got the following answer. After reading the logs I had a feeling this might be the root cause. So please check you have the most up to date version of Node.js

enter image description here

Upvotes: 1

Alapan Das
Alapan Das

Reputation: 18650

You can do two things:

  1. Run the command npm cypress cache clear and then again install cypress npm install cypress --save-dev and check.

  2. Or, install npm globally without sudo using the command npm install -g. Then create a new folder and then run npm init, npm install cypress --save-dev and npx cypress open.

Upvotes: 0

Related Questions