jamjar
jamjar

Reputation: 635

`npm run jshint` results in `missing script: jshint`

I'm trying to jshint a few javascript files, but for some reason the local npm install of jshint isn't working.

The package is there:

$ npm list --depth=0
[email protected] /Users/me/workspace/testapp
└── [email protected]

And the error I get is the following:

$ 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

I can work around this with a global install, but I'd prefer to have it working locally.

Upvotes: 3

Views: 1096

Answers (1)

cartant
cartant

Reputation: 58400

According to the documentation npm run is an alias for npm run-script and runs one of the scripts in the package.json file. If you add a jshint script entry to your package.json, it should run your locally-installed jshint:

{
    "name": ...,
    "version": ...,
    "scripts": {
        "jshint": "jshint"
    }
}

Upvotes: 1

Related Questions