[英]`npm run jshint` results in `missing script: jshint`
我正在尝试jshint一些javascript文件,但由于某种原因,本地npm安装的jshint无法正常工作。
包裹在那里:
$ npm list --depth=0
testapp@1.0.0 /Users/me/workspace/testapp
└── jshint@2.9.3
我得到的错误如下:
$ npm run jshint
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/5.6.0/bin/node" "/usr/local/bin/npm" "run" "jshint"
npm ERR! node v5.6.0
npm ERR! npm v3.6.0
npm ERR! missing script: jshint
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/me/workspace/testapp/npm-debug.log
我可以通过全局安装来解决这个问题,但我更愿意让它在本地工作。
根据文档, npm run
是npm run-script
的别名,并运行package.json
文件中的一个scripts
。 如果在package.json
添加jshint
脚本条目,它应该运行本地安装的jshint
:
{
"name": ...,
"version": ...,
"scripts": {
"jshint": "jshint"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.