今天在学习tslint的时候,按照git clone下angular2-webpack-starter的代码执行npm run lint时,虽然代码进行了检测,但检测完成后npm始终报错,

//package.json 报错的配置

"scripts": {
"lint": "tslint \"src/**/*.ts\"",
},
//返回的错误

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Carter\\AppData\\Roaming\\npm\\node_modules\\cnpm\\node_modules\\npm\\bin\\npm-cli.js"
"--userconfig=C:\\Users\\Carter\\.cnpmrc" "--disturl=https://npm.taobao.org/mirrors/node" "--registry=https://registry.npm.taobao.org" "run" "lint"
npm ERR! node v4.2.4
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! ng2-webpack-starter-demo@1.0.0 lint: `tslint "src/**/*.ts"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the ng2-webpack-starter-demo@1.0.0 lint script 'tslint "src/**/*.ts"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ng2-webpack-starter-demo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tslint "src/**/*.ts"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ng2-webpack-starter-demo
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ng2-webpack-starter-demo
npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request:
npm ERR! D:\GitHub\ng2-webpack-starter-demo\npm-debug.log

经过google一番,终于找到解决方案

原因是因为,当npm执行script完成时,script需要返回一个状态为0的code,npm才会正常退出,

因为tslint执行完成后检测到有错误,所以没有返回code 0,所以导致npm构建出现了错误。

tslint 修复后给了一个参数 --force,即使检测的代码中有错误,也强制返回code 0。

//package.json 修复错误

"scripts": {
"lint": "tslint \"src/**/*.ts\" --force",
},

资料:

https://github.com/palantir/tslint/issues/1057

https://github.com/palantir/tslint/issues/1012

https://github.com/palantir/tslint/issues/1059

最新文章

  1. ZKWeb网页框架1.1正式发布
  2. SQL Server 聚合函数算法优化技巧
  3. MVC 教程汇总
  4. Kafka深度解析,众人推荐,精彩好文!
  5. C# RSA PEM解密字符
  6. tomcat 一个服务 多端口网站
  7. Quartz Scheduler(2.2.1) - Integration with Spring
  8. Android GridView、ListView、ScrollView上下拉刷新
  9. MapReduce详解
  10. 完整Log4Net配置信息
  11. 统计细菌基因组ORF
  12. 自动弹出pickerview
  13. C# 线程安全集合
  14. luogu P1641 [SCOI2010]生成字符串
  15. liunx java环境搭建
  16. LOJ6036编码
  17. 【转】C#异步的世界【上】
  18. [Linux] ubuntu各目录含义
  19. CAN通信(STM32)
  20. JavaScript学习总结(八)——JavaScript数组

热门文章

  1. extern c
  2. leetcode 83
  3. mysql中union与union all的区别
  4. NSLog的使用
  5. 取消双向绑定、输出html代码
  6. asp.net mvc JQGrid
  7. [原]Python Web部署方式总结
  8. Nginx+Tomcat+Memcached集群
  9. Head First-策略模式
  10. PhpStrom 配置Xdebug