问题
I installed jshint using npm install -g jshint. I'm not sure if there is a problem with my node installation or what but when in the terminal and I run jshint it doesn't do anything. It doesn't show anything but a blank line them the next terminal prompt comes up. After a new install of node after having previous troubles after an upgrade when I ran the npm install -g jshint command it didn't look like it ran like it usually does. Here is the output from trying to install jshint.
$ npm install -g jshint
/Users/michael/.nvm/v0.10.32/bin/jshint -> /Users/michael/.nvm/v0.10.32/lib/node_modules/jshint/bin/jshint
jshint@2.5.6 /Users/michael/.nvm/v0.10.32/lib/node_modules/jshint
├── strip-json-comments@1.0.1
├── underscore@1.6.0
├── exit@0.1.2
├── shelljs@0.3.0
├── console-browserify@1.1.0 (date-now@0.1.4)
├── minimatch@1.0.0 (sigmund@1.0.0, lru-cache@2.5.0)
├── htmlparser2@3.7.3 (domelementtype@1.1.1, domutils@1.5.0, entities@1.0.0, domhandler@2.2.0, readable-stream@1.1.13)
└── cli@0.6.4 (glob@3.2.11)
回答1:
Your installation seems fine.
To use it, simply type:
jshint yourfile.js
You can also use it for a whole directory. For example, to use it in the current directory:
jshint .
If JSHint doesn't find any errors, it doesn't output anything. So that might be the "problem" here.
回答2:
An uninstall of my node_modules and reinstall seemed to fix my problem.
来源:https://stackoverflow.com/questions/26345412/jshint-not-working