微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决安装 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 上的一些主题和 cypress 存储库上的一些主题之后,这对我有帮助,我希望它可以帮助其他人。

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

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

现在我获得了全新安装的 cypress 附带的所有基本文件。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。