在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 ...
随机推荐
- 【WCF】Silverlight+wcf+自定义用户名密码验证
本文摘自 http://www.cnblogs.com/virusswb/archive/2010/01/26/1656543.html 在昨天的博文Silverlight3+wcf+在不使用证书的情 ...
- 错误处理php
一 HP关闭脚本错误提示的方法: 打开PHP安装目录下的php.ini文件 找到display_errors = On 修改为 display_errors = off 注意:如果你已经把PHP.in ...
- 解读CSS布局之-水平垂直居
对一个元素水平垂直居中,在我们的工作中是会经常遇到的,也是CSS布局中很重要的一部分,本文就来讲讲CSS水平垂直居中的一些方法.由于我们大搜车的日常工作中已经不再需要理会低版本IE,所以本文所贴出的方 ...
- 十、Struts2结果集
十.Struts2结果集 1.Struts.xml配置文件 result元素:指定动作类的动作方法执行完后的结果视图. 属性: name:字符串,与 ...
- C++类成员函数的 重载、覆盖和隐藏区别
重载:成员函数被重载的特征: (1)相同的范围(在同一个类中): (2)函数名字相同: (3)参数不同: (4)virtual 关键字可有可无. #include <iostream> u ...
- url中文参数解决方案
首先,弄清楚为什么url传递中文会转码或者乱码,以及http头 contentType="text/html; charset=GBK" 的作用. html代码会经过web服务器, ...
- Linux下发包处理
Linux下发包处理: 1.用top分析工具来查看哪个进程占用的CPU资源比较大 2. 通过命令来查看都是那些端口被占用了 netstat -antp | more 3.在top里面查看到的异 ...
- 在PeopleSoft系统中实现打印页面的功能
我们知道,在PeopleSoft HCM里,一般上了薪酬模块的话,都会客户化工资单页面,去匹配公司之前的工资单的报表的格式.有的时候,这个工资单页面又需要打印出来,以供员工的使用.PeopleSoft ...
- C# 执行JS
需引用命名空间:Microsoft.VsaMicrosoft.JScript using System; using System.Collections.Generic; using System. ...
- css3动画响应式404页面
PC端效果: 模拟触屏端效果: 兼容性:触屏端及桌面端(优雅降级至IE6) 模板下载: http://pan.baidu.com/s/1o67ftc2