【问题标题】:Cypress: Unable to install binary file赛普拉斯:无法安装二进制文件
【发布时间】:2020-12-14 19:24:12
【问题描述】:

我正在尝试使用二进制文件安装 cypress。目前在 vs 代码中使用以下命令:CYPRESS_INSTALL_BINARY=C:\Users\abcd\Downloads\cypress.zip npm install cypress

来源:https://docs.cypress.io/guides/getting-started/installing-cypress.html#Install-binary

这对我不起作用,显示以下错误:

CYPRESS_INSTALL_BINARY=C:\Users\abcd\Downloads\cypress.zip : The term 'CYPRESS_INSTALL_BINARY=C:\Users\abcd\Downloads\cypress.zip' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ CYPRESS_INSTALL_BINARY=C:\Users\abcd\Downloads\cypress.zip npm ins ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (CYPRESS_INSTALL...ads\cypress.zip:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

谁能帮我解决这个问题? 谢谢!

【问题讨论】:

  • 您是否按照文档尝试了另外两种方法?
  • 选项 1:我不想安装冲突的二进制版本。选项 2:无法绕过公司防火墙。

标签: node.js cypress


【解决方案1】:

我用几个 npm 命令解决了这个问题:

    "e2e": "npm run e2e:installcypress && npm run e2e:run && npm run e2e:coverage",
    "e2e:installcypress": "CYPRESS_INSTALL_BINARY=/path/to/cypress.zip npm install cypress",
    "e2e:run": "ng e2e",
    "e2e:coverage": "npx nyc report --reporter=lcov --reporter=html",

现在 npm run e2e 完成所有 3 个操作

【讨论】:

    【解决方案2】:

    试试这个 -

    set CYPRESS_INSTALL_BINARY=\your\path\to\cypress.x.x.x.zip
    
    npm install cypress
    
    npx cypress open
    

    【讨论】:

    • 如果你想默认使用电子 -> npx cypress run --headed
    • npx cypress open并选择电子浏览器执行测试。
    【解决方案3】:

    赛普拉斯二进制安装

    安装与默认 npm 包不同的版本。

    CYPRESS_INSTALL_BINARY=2.0.1 npm install cypress@2.0.3

    指定一个外部 URL(以绕过公司防火墙)。

    CYPRESS_INSTALL_BINARY=https://company.domain.com/cypress.zip npm install cypress

    指定要在本地安装而不是使用互联网的文件。

    CYPRESS_INSTALL_BINARY=/local/path/to/cypress.zip npm install cypress

    让它工作...通过将 UNIX 设置为 windows cmd 上的路径

    SET CYPRESS_INSTALL_BINARY=C:/Users/myUserName/Downloads/cypress.zip

    【讨论】:

    • 这不是答案。您从给定的链接发布了相同的内容。我的问题是选项 3 是抛出错误,那么如何解决它?
    • 你能在Github查看这个问题吗
    猜你喜欢
    • 2022-09-30
    • 1970-01-01
    • 1970-01-01
    • 2020-12-23
    • 1970-01-01
    • 1970-01-01
    • 2021-07-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多