Node.js -g parameter
The following node.js tutorial explains the usage of a -g parameter. The Node.js -g parameter installs Node.js globally. It can be used within the command line utilities such as npm or commands that come from globally installed modules.
For testing it, you can open your Node.js command prompt and run npm ls -g . If you see an empty list, no modules are installed globally.
How to install an NPM package globally
To download and install a package globally, use this command:
1 |
npm install -g <packagename> |
for instance:
1 |
npm install -g jshint |
In case of an EACCES error, it is necessary to fix your permissions. Alternatively, you can enhance the aforementioned command with sudo:
1 |
sudo npm install -g jshint |
If you still hesitate what installation to choose, read this article: