`npm 运行 jshint` 导致 `missing script: jshint`
`npm run jshint` results in `missing script: jshint`
我正在尝试 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
我可以通过全局安装解决这个问题,但我更愿意让它在本地工作。
根据 the documentation npm run
是 npm run-script
的别名,运行 是 package.json
文件中的 scripts
之一。如果您将 jshint
脚本条目添加到 package.json
,它应该 运行 您本地安装的 jshint
:
{
"name": ...,
"version": ...,
"scripts": {
"jshint": "jshint"
}
}
我正在尝试 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
我可以通过全局安装解决这个问题,但我更愿意让它在本地工作。
根据 the documentation npm run
是 npm run-script
的别名,运行 是 package.json
文件中的 scripts
之一。如果您将 jshint
脚本条目添加到 package.json
,它应该 运行 您本地安装的 jshint
:
{
"name": ...,
"version": ...,
"scripts": {
"jshint": "jshint"
}
}