我正在尝试jshint一些javascript文件,但由于某种原因,jshint的本地npm安装无法工作。
包裹在那里:
$ 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我可以通过全局安装来解决这个问题,但我更希望它能在本地运行。
发布于 2016-08-24 07:02:20
根据文献资料的说法,npm run是npm run-script的别名,在package.json文件中运行scripts之一。如果将jshint脚本项添加到package.json中,则应运行本地安装的jshint。
{
"name": ...,
"version": ...,
"scripts": {
"jshint": "jshint"
}
}https://stackoverflow.com/questions/39116249
复制相似问题