10

I've installed nodeJS ( from http://nodejs.org/ ). This has installed nodeJS & npm. Then I run npm install jslint.

The package manager create a folder in my current working directory, and place the required file in it.

Then I guess I should do a symlink in my /usr/local/bin/ folder in order to have a global jslint command.

But the whole point is that following that procedure, the jslint files are inside a specific project folder ( that was my current working folder of that moment ), and not in a generic place.

How should I proceed to have a clean installation ?

1 Answer 1

16

I just discovered a -g option, witch install the package globally:

npm install -g jslint

install jslint in /usr/local/bin/jslint , and I can now run jslint in the shell directly without having to create a symlink :)

If you are getting installation errors you might need

sudo npm install -g jslint

although normally that's not required

Sign up to request clarification or add additional context in comments.

4 Comments

As your answer is correct, I suggest you accept it, as the FAQ suggests here.
Just as a note: you really shouldn't need sudo for this (I didn't). npm install -g jslint should do the trick fine all by itself.
@ryentzer If you are getting errors installation errors when not using sudo something is wrong with your settings
@ierax: On OSX, if you use the regular Node.js installer, you do need sudo to install packages globally, which are installed below /usr/local. By contrast, if you use installers such as nvm or n, which install Node.js (instances) at the user level, you do not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.