2016-08-26 15 views
0

亲爱的stackoverflowers。将`jshint` worker添加到`scripts` for package.json

我决定将jshint加入我的项目中,以帮助我检测JavaScript代码中的错误和潜在问题。我已将它安装在项目的根目录下,并且能够从控制台运行下一代码:

jshint --config .jshintrc ./app/ 

它返回了几个通知。

Then I v decided to create a special section inside my package.json scripts` section。它看起来像:

"scripts": { 
    "jshint": "jshint --config .jshintrc ./app/" 
    } 

当我尝试运行

npm run jshint 

它返回我异常...

enter image description here

回答

1

请检查出来https://github.com/npm/npm/issues/6124,你可以如果您使用以下||来设置脚本,请防止出现此错误真像代码片段波纹管

{ 
"scripts": { 
    "test": "jshint || true" 
} 
} 
在这种情况下

你的脚本将退出代码= 0,NPM完成不会引发错误

相关问题