Setting up JavaScript Lint tools using NPM on Ubuntu system

I’m trying to get JavaScript linting tools working on my Ubuntu 11.10 machine but running into several issues. I downloaded the source files for jsl version 0.3.0 from the official website, but when I look inside the folder there’s no configure script or autogen.sh file to help me compile it properly.

When I try to install the downloaded tarball using npm, I get this error:

user@laptop:~/javascript-lint-0.3.0/source$ sudo npm install ~/Downloads/javascript-lint-0.3.0-source.tar.gz -g
npm ERR! couldn't unpack /tmp/npm-1324904212208/1324904212208-0.02443970972672105/tmp.tgz to /tmp/npm-1324904212208/1324904212208-0.02443970972672105/contents

I also tried installing jslint directly through npm but that gives me a different error:

user@laptop:~/javascript-lint-0.3.0/source$ sudo npm install jslint -g
npm ERR! error installing [email protected] Error: Refusing to delete: /usr/local/bin/jslint not in /usr/local/lib/node_modules/jslint

My Node.js is version 0.6.6 and I installed both Node and npm using an installation script. Has anyone successfully set up JavaScript linting tools on Ubuntu and can share what worked for them?

Those errors indicate that your npm installation may have gotten corrupted during setup. I faced a similar issue when I first installed Node on Ubuntu 11.10. The path conflicts usually occur due to a misconfiguration in the install script.

Instead of trying to fix the broken npm, consider starting fresh. You can remove Node and npm by running sudo apt-get remove nodejs npm, and then manually delete any leftover files in /usr/local/lib/node_modules and /usr/local/bin.

After clearing everything out, reinstall Node and npm using Ubuntu’s official repositories: sudo apt-get install nodejs npm. This method tends to provide a cleaner setup that works seamlessly with global packages. Once everything is reinstalled correctly, you should be able to install both jslint and eslint without running into those pesky permission and extraction issues.

skip jsl - it’s outdated. run npm install -g eslint instead. works better on ubuntu and won’t give u those weird path issues. if it still fails, fix ur npm permissions first: sudo chown -R $(whoami) ~/.npm

I’ve encountered the same issue on Ubuntu. The problem with jslint arises from conflicting files in the system paths. Begin by manually removing the troublesome file with: sudo rm /usr/local/bin/jslint, then attempt the npm installation again. The extraction error from the tarball often suggests that the download was either corrupted or not fully completed. To avoid the hassle of manual compilation, I recommend using nvm (Node Version Manager). This approach simplifies your Node.js installation and resolves those path conflicts. After switching to nvm, you should find that eslint or jshint installs without the permission issues.