今天在学习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

在package.json中配置Script执行npm run tslint报错问题的更多相关文章

  1. vue-electron 使用sqlite3数据库,执行npm run build 报错 .NET Framework 2.0 SDK,Microsoft Visual Studio 2005[C:\temp\wechat\node_modules\sqlite3\build\binding.sln]

    问题描述 vue-electron 使用sqlite3数据库,执行npm run build 报错如下: .NET Framework 2.0 SDK,Microsoft Visual Studio ...

  2. vue中执行npm run build报错解决方法?

    遇到了执行npm run build 后报错: [build:js ] Module not found: Error: Can't resolve 'scss-loader' in 'D:\work ...

  3. vue.js环境配置步骤及npm run dev报错解决方案

    安装完成后,使用npm run dev 运行,成功后,就可以在浏览器中看到vue的欢迎画面了 最后一步可能报错,我就遇到这样的问题了, 个人问题仅供参考: ERROR Failed to compil ...

  4. Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法

    Laravel 5.4 Mix & Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法   首先进入package.json文 ...

  5. 巨坑npm run dev 报错 终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build/css/add.p

    Windows10环境 npm run dev 报错  终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build ...

  6. atom执行num run dev报错

    # atom运行npm run dev报错问题 运行描述 vue项目,直接在终端中运行 npm run dev 可以成功执行.但是在atom安装的platformio-ide-terminal插件中打 ...

  7. vue项目初始化时npm run dev报错webpack-dev-server解决方法

    vue项目初始化时npm run dev报错webpack-dev-server解决方法 原因:这是新版webpack存在的BUG,卸载现有的新版本webpack,装老版本就好webpack-dev- ...

  8. npm run server报错

    从git上clone的vue项目npm install后npm run server报错 $ npm run dev > lufei@1.0.0 dev E:\pythonProject\luf ...

  9. nuxt.js 初始化 npm run dev 报错

    在初始化 npm install 了基本依赖后: npm run dev 报错: error in ./server/index.js Module build failed: Error: Plug ...

随机推荐

  1. SSIS Error Code DTS_E_OLEDB_NOPROVIDER_64BIT_ERROR

    将一批Job从一台agent服务器搬到另外一台agent, 没有做任何的修改,但是job执行的时候报错. Error: 2014-07-03 14:42:57.14 Code: 0xC0209303 ...

  2. js获得浏览器的尺寸

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  3. (笔记)angular 单选选项卡

  4. (笔记)angular material 选项卡用法

  5. Windows Server 2008 R2 实现多用户连接远程桌面

    前提 1. 确认自己的计算机开启了远程连接 2. 在远程桌面会话主机配置中将"限制每个用户只能进行一个会话"的勾去掉. 实现方法 1. 需要在角色里面安装远程桌面服务: 2. 在用 ...

  6. SQL Server 遇到 Automation服务器不能创建对象

    Windows 2003  安装SQL Server出现Automation问题  如下:  ######安装SQL Server 遇到 Automation服务器不能创建对象问题 解决办法: 1.1 ...

  7. C#关于一个程序,只可以有一种实例的方法

    方法一:使用线程互斥变量. 通过定义互斥变量来判断是否已运行实例.把program.cs文件里的Main()函数改为如下代码: 说明:程序中通过语句 System.Threading.Mutex ru ...

  8. Vue.js学习 Item6 -- Class 与 样式绑定

    数据绑定一个常见需求是操作元素的 class 列表和它的内联样式.因为它们都是 attribute,我们可以用 v-bind 处理它们:只需要计算出表达式最终的字符串.不过,字符串拼接麻烦又易错.因此 ...

  9. css基础学习

    css(Cascading style sheets):层叠样式表 1.图片替换技术 以下代码表示:点击百度logo的图片就会跳转到百度首页. <style > .baidu{ /*宽高定 ...

  10. 配置pxe 自动化安装centos6.7

    dhcp服务器是pxe自动化安装的必要条件,因此先搞定dhcp服务器,yum -y install dhcp,  rpm -ql dhcp查看安装了哪些包,less /etc/dhcp/dhcpd.c ...