安装Cypress时出错:Cypress无法运行,因为此二进制文件在此没有可执行权限:



在安装Cypress.io时出现错误。我按照文档中的步骤操作,仍然出现以下错误:

Cypress cannot run because this binary file does not have executable permissions here:
/Library/Caches/Cypress/6.8.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.

文件夹结构是app/e2e/,并且现在基本上只包含yarn.lock&package.json

我运行的命令是:

yarn init
yarn add cypress
yarn run cypress open

然后尝试:

sudo yarn add cypress
yarn run cypress open

仍然不起作用,所以我尝试了:

cypress cache clear  

还是没用。。。

在SO和Cyprus repo上关注了一些线程后,以下是对我的帮助,我希望它能帮助其他人。

在我的情况下,我删除了现有的e2e文件夹(可能不需要(,然后在我的应用程序中创建了一个新的e2e文件夹,然后运行以下程序:

yarn init
yarn add cypress
yarn run cypress install // this was the key
yarn run cypress open

现在,我得到了所有的基础文件,与新安装的柏树。

最新更新