Saturday, August 29, 2015

Installing JSHint on Ubuntu using npm


When I tried to install jshint on Ubuntu 12.04 using npm, I got errors. It simply didn't work.

If you are trying to use SublimeLinter-jshint for Sublime Text 3, it won't work unless you install 2 things:
1. node.js
2. jshint

Default version on repo for Ubuntu 12.04
$ /usr/bin/node --version
v0.6.12
$ npm --version
1.1.4

When you try
$ /usr/bin/npm install -g jshint
npm http GET https://registry.npmjs.org/jshint

npm ERR! Error: failed to fetch from registry: jshint
...
...
npm not ok


The important thing to note is you must have recent version to install it properly.

Solution

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository --yes ppa:chris-lea/node.js
$ sudo apt-get install nodejs
$ sudo apt-get update

Check the version to confirm once.
$ npm --version
1.4.28
$ node --version
v0.10.37

and finally...
$ sudo npm install -g jshint
/usr/bin/jshint -> /usr/lib/node_modules/jshint/bin/jshint

Success. It's now installed.

Now if you restart the Sublime text and start with any js file, you can see the jshint will hint you for warnings and errors.a

1 comment:

  1. Nano Titanium Iron - TitaniumART
    Nanotiron oxide at womens titanium wedding bands the columbia titanium TITanium surface is a titanium bikes flexible oxide mens titanium watches which has no impact westcott scissors titanium upon the magnetic field. The high yields of the metal oxide $1.80 · ‎In stock

    ReplyDelete