what does the “-g” flag do in the command “npm install -g “?

-g tells npm to install the named module so that it’s accessible globally.

But it’s important to understand that -g is typically only used for packages that provide command-line utilities so that their executable components are available in the system PATH.

If you have multiple programs that require the same package, each program should install the package locally. If you really want to share an installed package by installing it globally, you have to also use npm link.

See the docs on the topic of globally installed packages here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)