DEV Community

Cover image for npm Vs npx

npm Vs npx

Jagroop Singh on October 04, 2024

If you’ve been working with Node.js, you’ve likely encountered both npm and npx. While they sound similar and are both integral parts of the Node....
Collapse
 
florianrappl profile image
Florian Rappl

npm (officially lower cased) is not short for Node Package Manager. It's a common misconception.

Although "npm" is commonly understood to be an abbreviation of "Node Package Manager", it is officially a recursive backronym for "npm is not an acronym".

Collapse
 
samiksha2903new profile image
Samiksha Chaudhary

I read ur explanations and that's really eye opener hence got to kn never trust LLMs blindly.
Thanks indeed!!!

Collapse
 
jagroop2001 profile image
Jagroop Singh

@florianrappl ,So it’s really a backronym saying “npm is not an acronym”? That’s a bit mind-boggling!

Collapse
 
florianrappl profile image
Florian Rappl

Yes @jagroop2001 it is indeed mind-boggling. I never understood that. Surely, "npm" has not been coined in a vacuum - so it definitely meant / was intended to mean node package manager. I am really unsure why they did not just follow this (my assumption is that "they" are not affiliated with Node.js / the company original behind Node.js (Joyent) and therefore did not want to risk a trademark violation / having troubles due to the name).

Thread Thread
 
bagelbomb profile image
Tanner Iverson

Actually, the creator of npm (Isaac Z. Schlueter) worked closely with and on Node from the get go, eventually becoming the lead developer on Node at Joyent. I'm pretty sure the reason behind it not standing for Node Package Manager is just to be funny / mess with people. I don't think they really care what people think it stands for 😄

Collapse
 
rupak_boral profile image
Rupak Boral

Yes that's what I was going to say.

Collapse
 
bagelbomb profile image
Tanner Iverson

Interesting stuff! For anyone looking for the source to this (like I was), it's on the npm GitHub README:
github.com/npm/cli?tab=readme-ov-f...

Collapse
 
rajeshkumaryadavdotcom profile image
Rajesh Kumar Yadav

Please explain in detail

Collapse
 
florianrappl profile image
Florian Rappl

Ok what's unclear? "npm" is essentially just "npm". Officially it does not abbreviate anything. It's just made up - like any other product or company name.

Thread Thread
 
rajeshkumaryadavdotcom profile image
Rajesh Kumar Yadav

Chat GPT says

In Node.js, npm stands for Node Package Manager. It is the default package manager for the Node.js runtime environment, allowing developers to share and reuse code by downloading, installing, and managing packages (libraries or modules) that other developers have published.

Thread Thread
 
florianrappl profile image
Florian Rappl

How about using your brain for once? I'll not explain what hallucinations are and why chatgpt can't be trusted as it should be clear right now. Otherwise, please educate yourself using sources such as the npm website or Wikipedia.

Thread Thread
 
jagroop2001 profile image
Jagroop Singh

@florianrappl , @rajeshkumaryadavdotcom ,
There are two ways to look at it. One view is that "npm" stands for "Node Package Manager," describing what it does (like Standard A). But officially, "npm" is just a name now, not an abbreviation (like Standard B). Both ideas exist, but the official stance is that it's just a name.

Thread Thread
 
florianrappl profile image
Florian Rappl

Sure we can agree on this (but nitpick: instead of "stands for" I'd phrase it "is a". As mentioned it does not stand for anything meaningful).

Thread Thread
 
rajeshkumaryadavdotcom profile image
Rajesh Kumar Yadav

@florianrappl are you being rude buddy? Sorry if I asked you question

Thread Thread
 
florianrappl profile image
Florian Rappl

@rajeshkumaryadavdotcom Hmm I did not see a question only a statement from chatgpt. Sorry if you meant a question instead - my intention was to motivate developers to look for their own answers using trustworthy sources instead of picking something from a LLM. So what is it you want to know my friend?

Thread Thread
 
rajeshkumaryadavdotcom profile image
Rajesh Kumar Yadav • Edited

Thank buddy, I got your point 😉

Collapse
 
ksns_sarwani profile image
KSNS SARWANI

Amazing knowledge...
I'm a complete beginner and I'm so excited to learn something interesting like this in easy way as mentioned in this article.... Is Node.js an ecosystem...? Is that a software or is that a programming language?

Collapse
 
jagroop2001 profile image
Jagroop Singh

@ksns_sarwani ,
Absolutely! Node.js is not a programming language; it's a runtime environment that lets you run JavaScript on the server-side. It’s part of an ecosystem because it includes npm, a package manager with thousands of libraries and tools, making it easy to build full applications.

Collapse
 
ksns_sarwani profile image
KSNS SARWANI

I got that... Thanks for detailed info... Can you tell me abt what does an ecosystem contains as a whole?
By your answer it seems that it is like what I listened about java runtime environment. (by the way, don't think I know completely abt JRM but I just read abt that in an article like this. )

Thread Thread
 
jagroop2001 profile image
Jagroop Singh

@ksns_sarwani ,
You're welcome!
Yes, exactly—like the Java Runtime Environment, an ecosystem includes everything needed to run and build apps, such as libraries, tools, and package managers (like npm in Node.js) to support development.

Thread Thread
 
ksns_sarwani profile image
KSNS SARWANI

OK.. Thank you... Need to know a lot... I'm at very beginning...

Thread Thread
 
jagroop2001 profile image
Jagroop Singh

@ksns_sarwani ,🌟 Don't get disheartened if you don't know 100% about something; sometimes it's not required.
✨ Just focus on working towards your goals, whether it's learning new tech, landing a job, or anything else!
💪 Keep pushing forward and keep fighting!

Thread Thread
 
ksns_sarwani profile image
KSNS SARWANI

Sure.... And thank you 😊

Collapse
 
maximovj profile image
Victor J. Maximo

Already I knew but I prefer use pnpm, anyway thanks 👍

Collapse
 
jason_shultz_8ad592484eb6 profile image
Jason Shultz

pnpm is basically npm, but it handles packages in a different, more efficient way. pnpm, npm, and yarn all handle package installation for an application differently. You probably already know this, this is more for other users who may not know the difference.

Collapse
 
jagroop2001 profile image
Jagroop Singh

Absolutely! pnpm is indeed a great alternative to npm and Yarn, offering a unique approach to package management. While npm installs packages in a flat node_modules structure, pnpm uses a content-addressable store, which means it links packages from a central location. This not only saves disk space but also speeds up installation times.

Collapse
 
adam_josh_684366006495d7c profile image
Adam Josh

npm is a package manager for Node.js, used to install and manage libraries or tools globally or locally. npx comes with npm and allows you to run Node packages without installing them globally, useful for one-time use or testing tools without polluting the system. Click Here for details

Collapse
 
jagroop2001 profile image
Jagroop Singh

@adam_josh_684366006495d7c , thanks for sharing !!

Collapse
 
peter_wayland profile image
Peter Wayland

Anybody knows if there's such a NPX like terminal command for Python? That would be really useful than install bunches of libraries that you may never use again!

Collapse
 
jagroop2001 profile image
Jagroop Singh

@peter_wayland ,
I think,
you can use pypx or pypackages for similar functionality in Python! They allow you to run Python packages without globally installing them, making it easy to try out packages without cluttering your environment.

Collapse
 
peter_wayland profile image
Peter Wayland

Thanks for the tip brow.now I believe there's no such a thing for C++ right!?

Thread Thread
 
jagroop2001 profile image
Jagroop Singh

@peter_wayland ,
That's right! C++ doesn’t have a single ecosystem like Node.js or Java. Instead, it relies on various compilers (like GCC, Clang, or MSVC) and libraries you can include as needed, but there isn't a unified package manager or runtime environment.

Thread Thread
 
peter_wayland profile image
Peter Wayland

Yeah that's what I've thought. Thanks

Collapse
 
works profile image
Web

@jagroop2001 ,
Thank you; this is a really clear and informative piece.

Collapse
 
jagroop2001 profile image
Jagroop Singh

@works ,You're welcome!

Collapse
 
bagelbomb profile image
Tanner Iverson

Btw, I'm not sure if it's officially the case, but npx is typically thought to stand for Node Package eXecutor. Helps to understand what it does

Collapse
 
jagroop2001 profile image
Jagroop Singh

@bagelbomb ,
Interesting !!
npx is generally known as Node Package eXecutor, used to run Node.js packages directly.

Collapse
 
marusoft profile image
Alimi Kehinde Morufudeen

Nice article and explanatory

Collapse
 
jagroop2001 profile image
Jagroop Singh

Thanks @marusoft

Collapse
 
serkancakmak profile image
serkan cakmak

Thank you

Collapse
 
jagroop2001 profile image
Jagroop Singh

@serkancakmak ,You're welcome !

Collapse
 
vickey74238426 profile image
Vickey

Helpful!

Collapse
 
jagroop2001 profile image
Jagroop Singh

@vickey74238426 , thanks

Collapse
 
as_ayush01 profile image
Ayush Soni

Yes, this is what I wanted.I had some doubts related to this but now all are clear.

Collapse
 
jagroop2001 profile image
Jagroop Singh

@as_ayush01 ,
I'm glad that helped clarify things for you!

Collapse
 
laxmann profile image
Laxman Nemane

Thank you, it's wonderful!

Collapse
 
jagroop2001 profile image
Jagroop Singh

@laxmann ,You're welcome!

Collapse
 
leander_berg_0be0a9d17dd0 profile image
Leander Berg

The comments on this site are quite bizarre sometimes. People saying "I knew that already", "I don't even know what node is", "I'm not using node" like why are any of you reading this article? 😂