Node.js -g parameter

- Node.js

Node.js tutorial

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:

for instance:

In case of an EACCES error, it is necessary to fix your permissions. Alternatively, you can enhance the aforementioned command with sudo:

Source

If you still hesitate what installation to choose, read this article: Global vs Local install explained

More tips from the cookbook