npm - 如何忽略 npm 运行错误并继续使用 Travis-CI?
问题描述
我在 Travis 配置中有阶段启动npm run build
,其中构建是转换 ts -> js 的脚本。在本地,它返回两个无关紧要的错误,无论如何我都可以运行服务器。但是,这些错误阻止了 Travis 继续前进并失败了。
- stage: "Build front"
before_script:
- cd front
- npm install
- npm run build
错误:
...
[0] npm run build:client exited with code 0
build/setupProdServer.ts(6,20): error TS2307: Cannot find module '../src/vue-ssr-server-bundle.json'.
build/setupProdServer.ts(7,28): error TS2307: Cannot find module '../src/vue-ssr-client-manifest.json'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
...
我尝试添加
allow-failures:
- node
- npm
它没有帮助。
我需要 Travis 忽略这些错误并进入下一阶段。
Travis 中什么样的命令或参数会解决它?
解决方案
只需添加|| true
:
- npm run build || true
推荐阅读
- c# - SqlCommand 。ExecuteReader 方法慢
- swift - 动画下拉UIView时TableView单元格不改变高度
- mysql - MYSQL - 如何在 JSON 数组中搜索?
- c - 编译器将 printf 更改为 puts
- php - 填充单元格颜色后边框消失
- java - 如何使每次按下回车键时,Java 中都会弹出一个新文本?
- php - 不允许使用特殊表达式 - PHP 中的正则表达式
- xamarin.forms - Zebra 条码扫描器 SDK:Xamarin 表单
- reactjs - 将道具发送到数字格式 - Material UI TextField
- excel - 通过更改指定单元格中的日期来定义 Vlookup 结果列