在package.json中配置Script执行npm run tslint报错问题
今天在学习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报错问题的更多相关文章
- 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 ...
- vue中执行npm run build报错解决方法?
遇到了执行npm run build 后报错: [build:js ] Module not found: Error: Can't resolve 'scss-loader' in 'D:\work ...
- vue.js环境配置步骤及npm run dev报错解决方案
安装完成后,使用npm run dev 运行,成功后,就可以在浏览器中看到vue的欢迎画面了 最后一步可能报错,我就遇到这样的问题了, 个人问题仅供参考: ERROR Failed to compil ...
- Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法
Laravel 5.4 Mix & Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法 首先进入package.json文 ...
- 巨坑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 ...
- atom执行num run dev报错
# atom运行npm run dev报错问题 运行描述 vue项目,直接在终端中运行 npm run dev 可以成功执行.但是在atom安装的platformio-ide-terminal插件中打 ...
- vue项目初始化时npm run dev报错webpack-dev-server解决方法
vue项目初始化时npm run dev报错webpack-dev-server解决方法 原因:这是新版webpack存在的BUG,卸载现有的新版本webpack,装老版本就好webpack-dev- ...
- npm run server报错
从git上clone的vue项目npm install后npm run server报错 $ npm run dev > lufei@1.0.0 dev E:\pythonProject\luf ...
- nuxt.js 初始化 npm run dev 报错
在初始化 npm install 了基本依赖后: npm run dev 报错: error in ./server/index.js Module build failed: Error: Plug ...
随机推荐
- Backup App's data without rooting the phone
First I'd like to let you know that my phone is Android 6.0 Marshmallow. So it works on the latest A ...
- my vimrc
runtime! debian.vim "设置编码 ,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 ,ucs-bom,chinese "语言 ...
- 【EF学习笔记03】----------使用原生Sql语句
在EF中使用原生SQL,首先要创建上下文对象 using (var db = new Entities()) { //数据操作 } 新增 string sql = "insert into ...
- 学生信息管理系统应用ios源码iPad版
学生信息管理系统应用iPad版,该应用源码比较完整的,而且也很详细,这也是一款学校用的学生和老师管理系统,里面涉及到了很多ipad常用的控件,操作和数据存储. <ignore_js_op> ...
- VBA添加表格
Sub 添加表格() ' If MsgBox("要为所有表格添加列吗?", vbYesNo + vbQuestion) = vbYes Then To ActiveDocument ...
- c#中Split函数的使用介绍
平时经常用到split,在这里做一个系统的总结. Split函数 作用 返回一个下标从零开始的一维数组,它包含指定数目的子字符串. 语法 Split(expression[, ...
- DataGridView点击排序完成后如何禁止自动排序
Summary: Disable sorting after clicking DataGridView columnheader,Prevent databound DataGridView fro ...
- Vue.js常见问题
1.Vuejs组件 vuejs构建组件使用 Vue.component('componentName',{ /*component*/ }): 这里注意一点,组件要先注册再使用,也就是说: Vue.c ...
- 14 个折磨人的 JavaScript 面试题
前端工程师有时候面试时会遇到一类面试官,他们问的问题对于语言本身非常较真儿,往往不是候选人可能期待的面向实际的问题(有些候选人强调能干活就行,至于知不知道其中缘由是无关痛痒的).这类题目,虽然没有逻辑 ...
- FaceBook微光闪烁---第三方开源--shimmer-android
Android上的微光闪烁shimmer效果,实现的手段不少,其中比较好的是facebook做的开源库:shimmer-android,其在github上的项目主页是:https://github.c ...