How do I install JSLint on Ubuntu?
I downloaded the source
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?
Here are the instructions I followed to have jslint working on Ubuntu 10.10/Vim 7.3 (and Mac OS X).
So, I’ve just spotted a mistake in the given link. Here are the correct steps (assuming you have already downloaded and unpacked the archive to your desktop:
$ cd /path/to/jsl-0.3.0/src $ make -f Makefile.ref $ cp Linux_All_DBG.OBJ/jsl /usr/local/bin/jsl
At that point you can open a new terminal window and type
$ jsl to display a quick help or invoke it from Vim or directly on a file in the terminal.
/usr/local/binis not your “PATH”, it’s only one of the many directories that can be part your
$ echo $PATHwill tell you what these directories are and thus where you can put the
jslexecutable. You can also put it in another place and add an alias to your
Why do you expect to be able to run
How to install JSLint on Ubuntu:
Install nodejs (includes
npm, the Node Package Manager):
sudo apt-get install nodejs
Install node-jslint. either globally:
sudo npm install -g jslint
or locally, and include it in
npm install jslint
and add this line to your
.bashrc(adjust version number as appropriate)
You said you just copied the source to /usr/local/bin. You need to compile it. Follow the build instructions in the README.html
- Each platform on which JS is built must have a *.mk configuration file in the js/src/config directory. The configuration file specifies the compiler/linker to be used and allows for customization of command-line options. To date, the build system has been tested on Solaris, AIX, HP/UX, OSF, IRIX, x86 Linux and Windows NT.
- Most platforms will work with either the vendor compiler or gcc. (Except that HP builds only work using the native compiler. gcc won’t link correctly with shared libraries on that platform. If someone knows a way to fix this, let us know.)
- If you define JS_LIVECONNECT, gmake will descend into the liveconnect directory and build LiveConnect after building the JS engine.
- To build a binary drop (a zip’ed up file of headers, libraries, binaries), check out mozilla/config and mozilla/nsprpub/config. Use ‘gmake -f Makefile.ref nsinstall-target all export ship’
interesting and rather sophisticated script. Crockford’s ideas about good coding
practices served as a springboard for many of these lint rules.
Look at your “jsl-0.3.0/src/README.html” file. This says:
1) You have a “source package”. You need to “build” it (with a C compiler), then install your build.
better known as SpiderMonkey) implementation. It consists of build
conventions and instructions, source code conventions, a design
walk-through, and a brief file-by-file description of the source.
(compiler, interpreter, decompiler, garbage collector, atom manager,
standard classes). It then compiles a small “shell” program and links
that with the library to make an interpreter that can be used
interactively and with test .js files to run scripts. The code has no
dependencies on the rest of the Mozilla codebase.
3) Here is Douglas Crockford’s original JSLint page:
4) And here is a a good example of how you might use JSLint locally, on your own PC:
5) You say you already have Rhino – good. In Google, you’ll find many obsolete links to www.jslint.com/rhino. Here’s why – along with links to current Rhino-related info:
‘Hope that helps!