Skip to content
Discussion options

You must be logged in to vote

When you install a package normally, it’s installed locally inside your project. It goes into that project’s node_modules folder and is added to package.json. Use this for libraries your project needs to run.
When you install a package with -g, it’s installed globally on your system. This is mainly for command-line tools you want to use anywhere (like build tools or dev utilities).
A global install does not affect your project folder and does not update your package.json. It only makes the tool available system-wide.
Simple rule:
If your project depends on it → install locally.
If it’s a CLI tool you use in the terminal → install globally.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by sumansingh20
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
npm
Labels
Question Ask and answer questions about GitHub features and usage npm Discussions around programming langages, open source and software development Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community!
4 participants