Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Josie Nagy
Josie Nagy
14,992 Points

How are npm and Node.js connected? - Beginner question

Warning: Non-CS background.

After reading more about npm on their official website and other articles/ documentation, I'm now confused about what's the connection between npm and Node.js.

As far as I understood: npm = Node.js's package ecosystem

So the 'n' from 'npm' stands for Node from Node.js?

Is so, then:

Node.js = backend scripting language

Node.js allows you to run JavaScript on the server (server-side JavaScript).

So that means that since I'm installing (Node) packages on my computer using npm, I'm surely using also using Node.js.

Is that optional? Or is it some sort of default? Maybe I'm not using Node.js?

I'm really okay with being completely wrong about this or missing some important basics that I need to learn. Any feedback would be appreciated, just point me in the right direction , thanks!

3 Answers

Well....npm is the package manager for JavaScript. There is a short video about "What is package management?". https://www.linkedin.com/learning/linux-package-managers-and-repositories/what-is-package-management I think it gives general idea of what npm does. Different languages have different Package Managers. And I believe if you don't do server-side rendering you don't need and you don't use Node.js. If you use only client-side JS (frontend) you need browser only.

Josie Nagy
Josie Nagy
14,992 Points

Thanks Kristine, that video helped a lot. Mentioning that every language has it's own package manager also helped!

I previously didn't have the concept of a package or package manager, so without that knowledge it was hard to grasp what npm is.

While researching after I found this article that explained the concept to beginners really well: https://www.impressivewebs.com/npm-for-beginners-a-guide-for-front-end-developers/

Thanks again!

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

npm can mean a lot of things but it's common to refer to it as Node Package Manager.

Node.js is a system for allowing you to bring JavaScript to the back end.

Npm itself is simply an Open Source project for JavaScript.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

I can't see your reply but I got it via email do you maybe deleted it, but to answer your question.

If you log on to https://www.npmjs.com/ and look at the top left, you'll random works each starting with the letters npm.

Nonody Peels Mangoes Notable Peru Mariachis Navy Penguin Mariachi Nestable Processes Mutate

Each time you log in or click on them, you get something different. The idea being that npm can mean a lot of things but is commonly known as Node Package Manager.

But really npm refers to the package manager for JavaScript which simply means a way of organising your JavaScript apps/projects. :-)