How do I install JSLint on Ubuntu?

user883807 picture user883807 · Jan 14, 2012 · Viewed 27k times · Source

How do I install JSLint on Ubuntu?

I downloaded the source jsl-0.3.0-src.tar.gz from http://www.javascriptlint.com/download.htm and then extracted it to a dir called jsl-0.3.0 on my Desktop. I then moved it to /usr/local/bin which I have read is my PATH. I also want to mention that I have Rhino 1.7 installed already.

When I try to run jsl from terminal I got the following message:

No command 'jsl' found, did you mean:
 Command 'jls' from package 'sleuthkit' (universe)
 Command 'js' from package 'rhino' (main)
 Command 'sl' from package 'sl' (universe)
 Command 'fsl' from package 'fsl' (multiverse)
jsl: command not found

So I how do I properly install JSLint?

Answer

gmunkhbaatarmn picture gmunkhbaatarmn · Jan 15, 2012

How to install JSLint on Ubuntu:

  1. Install nodejs (includes npm, the Node Package Manager):

    sudo apt-get install nodejs
    
  2. Install node-jslint. either globally:

    sudo npm install -g jslint
    

    or locally, and include it in $PATH:

    npm install jslint
    

    and add this line to your.bashrc (adjust version number as appropriate)

    alias jslint='~/.npm/jslint/0.1.8/package/bin/jslint.js'