今天在学习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. 转载:SMS软件FESWMS模型使用体会

    自学了SMS-FESWMS几个月,从其原理到具体应用都已经比较熟悉.感觉这个软件还是有许多不足,这也是需要进一步提高和改进的地方.下面谈谈自己的一些感受和体会. 首先,对一些比较简单的模型,软件的计算 ...

  2. 对像转成 和 byte 互转类库方法

    using System; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serializatio ...

  3. leetcode 24

    链表操作的,要注意标记头结点和边界问题. 代码如下: ListNode *swapPairs(ListNode *head) { if(head==NULL||head->next==NULL) ...

  4. 误删ext3的恢复方法

    1.Ext3文件系统结构的简单介绍在Linux所 用的Ext3文件系统中,文件是以块为单位存储的,默认情况下每个块的大小是1K,不同的块以块号区分.每个文件还有一个节点,节点中包含有文件所有者, 读写 ...

  5. VS软件对应编号

    VC6VC7(2003)VC8(2005)VC9(2008)VC10(2010)VC11(2012)VC12(2013)

  6. PHP出错界面详细说明

    在web 上所有常见的错误之一就是无效的链接.一旦从其它站点上出现了无效的链接,你会重新安排你 的站点.人们会将他们喜欢的站点存成书签,如果在三个月后再次访问时,仅仅发现的是'404 Not Foun ...

  7. html Doctype作用?

    Doctype它主要的作用来声明html的版本 <!Doctype html>这是html5的 不写可能会造成html5的功能不能用(具体会不会出错就要看浏览器的容错性)

  8. pthreads多线程数据采集

    以前使用curl的多线程并不是真正的多线程,只是一种模拟的多线程,现在使用pthreads来实现真正意义上的多线程. 下载: windows下: http://windows.php.net/down ...

  9. List集合实战总结

    //构造被分隔的集合 List<object> list = new List<object>(); for (int i = 0; i <= 100; i++) { l ...

  10. linux内核SPI总线驱动分析(二)(转)

    简而言之,SPI驱动的编写分为: 1.spi_device就构建并注册  在板文件中添加spi_board_info,并在板文件的init函数中调用spi_register_board_info(s3 ...