Why doesn't JSLint/JSHint work in Ubuntu?

I installed as described here and other places, but after using npm to install jslint, jshint, neither will work. Running "jslint", I only get:

/usr/bin/env: node: No such file or directory

Is there something wrong with the Ubuntu 13.10 repo, or do I have to set up some PATH variable myself?


Solution 1:

Due to a conflict with an older "node" package, nodejs gets installed as nodejs instead of node, the latter being what jshint is looking for.

Try this:

sudo ln -s /usr/bin/nodejs /usr/bin/node

For more information, see:

  • node.js conflicts (the node --purge solution didn't work for me on 13.04, hence the symlink above)
  • Issue reported on jshint's Github "Most likely the Node binary is not in your PATH."

Solution 2:

The issue is tracked on github where they also give an alternative solution that worked for me:

sudo apt-get install nodejs-legacy