SerenityJS-NPM CI命令问题入门-Serenity-BDD CLI jar

问题描述

我在Mac上工作,并且尝试着从https://github.com/serenity-js/serenity-js-cucumber-protractor-template中找到的Serenity JS模板项目开始。安装所有必备组件并克隆代码后,我运行了“ npm ci”命令,该命令失败,并显示以下错误

Looks like you need the latest Serenity BDD CLI jar. Let me download it for you...
I'm terribly sorry,but something didn't go according to plan.
The API call has Failed

我在个人PC上执行了相同的过程,但是没有出现此问题。因此,也许这与我的工作计算机的安全性有关?我具有管理员权限,但无法运行任何sudo命令。任何建议将不胜感激。

解决方法

@serenity-js/serenity-bdd模块无法下载Serenity BDD报告CLI(通过.jar分发的Java工件(https://jcenter.bintray.com/)时,将显示此错误。

npm installnpm ci命令在package.json中调用此postinstall script时,将调用下载过程本身:

"postinstall": "serenity-bdd update"

在工作设置中,可能有多个原因导致此错误:

  • 您的机器可能无法调用外部工件存储库,例如jcenter.bintray.com。如果是这种情况,那么您很可能拥有一个内部工件存储库(例如Artifactory或Nexus),该存储库可镜像外部存储库。如果有,则可以告诉serenity-bdd从那里获取.jar
"postinstall": "serenity-bdd update --repository https://mycompany.com/artfactory"
  • 另一个常见问题是企业代理使用SSL证书,您可以通过指示serenity-bdd忽略任何无效的证书来避免这种情况:
"postinstall": "serenity-bdd update --ignoreSSL"

希望这会有所帮助!

Jan