You do not need NPM to work with NodeJS
Tags: tutorial, beginners, javascript
Published: 2021-03-18 11:25:41

# <center> Introduction </center>

---

So I was just scrolling the feed as usual when I cam across an article where the tittle caught my eye:

{% link https://dev.to/calidion/why-node-js-has-never-be-a-production-ready-backend-environment-224p %}

I was reading the article and their was some interesting point but a lot of misunderstandings and non-comprehension of the JavaScript ecosystem.

After trying to explain in the comments what was the difference between NPM and Node.JS I thought it would be better to just create a post to stop the share of false information and to try and enlighten people.

---

# <center> Definitions </center>

---

## <center> JavaScript </center>

JavaScript, often abbreviated as JS, is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm.
[src](https://en.wikipedia.org/wiki/JavaScript)

## Node.JS

Node.JS is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.
[src](https://en.wikipedia.org/wiki/Node.js)

## NPM

NPM is the default package manager for the JavaScript runtime environment Node.JS. It consists of a command line client, also called NPM, and an online database of public and paid-for private packages, called the NPM registry.
[src](https://en.wikipedia.org/wiki/Npm_(software))

---

# <center> Corrected Assumptions </center>

---

## Node.JS Does not need NPM to function

If we look at the post mentioned in the introduction we can see that it starts of talking about Node.JS and then switches to mention NPM as if they were the same. The post judges Node.JS on the the problems of NPM. 

This is a big mistake in itself. Looking at the definition of NodeJS as well as the source code it is clear the **Node.JS itself DOES NOT use NPM**

Node.JS was created before NPM and had as a main goal to have a cross-platform environment for executing JavaScript as backend. Thus looking at the Node.JS source code we can easily see that its main languages are: JavaScript, Python and C++ (for bindings).

{% github nodejs/node %}

There is even a tutorial for building the source itself which means you still do not need NPM to build and run Node.JS as well as code in it.

---

## NPM needs Node.JS to funtion

If we look at the NPM source code we can see it is fully coded in JavaScript

{% github npm/cli %}

For NPM to work on any Operating System it will require Node as that is what the packet manager was made to work with. This is even specified in the `README.md`

> Node.js v10 or higher must be installed to run this program

---

## Lock files and NPM

The article in the introduction does mention that lock files are important and on that part I totally agree. However lock files have become a standard already used in all big and structured files and even in CI / CD. Lock files have been around for more than a few years and are already industry standard we could say.

A good article that explains this is the following. I believe this is what the author of the article in the introduction was trying to explain in his own terms:

[https://snyk.io/blog/what-is-package-lock-json/](https://snyk.io/blog/what-is-package-lock-json/)

---

# <center> Conclusions </center>

--- 

What should we keep in mind after this article? 

- Node.JS **does not** need NPM to function
- NPM **needs** Node.JS to function
- JavaScript **does not** need NPM or Node.JS to function (can be served through web)

---
Burlet Mederic
https://medericburlet.com
https://mederic.me
https://twitter.com/crimson_med