What is the difference between node.js runtime and npm package manager options while installing node.JS?

node.jsNpm

node.js Problem Overview


I am trying to install node.js by downloading the .exe file, I am confused and stuck on the Node.js setup where in it asks to install node.js runtime or npm package manager so I want to proceed through the installation after knowing fully the difference between the two.

> My question is what is the difference between node.js runtime and npm > pacakage manager and what are all the features do I get on the two > options.

My basic purpose of installing node.js is to compile Typescript, Please help me to understand the features of the two package screen shot of the installation window

node.js Solutions


Solution 1 - node.js

First of all, it does not ask you to install Node.js runtime OR npm package manager, it offers you to install them both (if you want)

Now, Node.js runtime is basically what will understand your javascript code and execute it to produce a result.

Npm package manager is a tool which will allow you to install third party libraries (other people's code) by using the command line.

npm install express

will install the framework called express for example.

Solution 2 - node.js

  • Node and Nodejs are the same. Interchangeable names for the same thing. Unless someone is talking about graph theory, trees or data structures.
  • Nvm is a Nodejs version manager. It let's you easily install and switch between versions. It retains globally installed packages for each version.
  • Npm is a package manager. It let's you install software (libraries, plugins, frameworks and applications). Typically this software is installed to build Node applications. Sometimes it isn't.

Put more simply. Npm depends on Node. Nvm installs Node.

Solution 3 - node.js

Node JS

  • Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.

  • Real-Time services (Chat, Games etc)

NPM

  • Npm is a package manager. Typically this software is installed to build Node applications.

  • It let's you install software (libraries, plugins, frameworks and applications).

Solution 4 - node.js

Node.js or Node is an open-source, cross-platform, JavaScript runtime environment(JSRE) that executes JavaScript code outside of a web browser.

npm is a package manager(like Nuget package manager in .NET -Microsoft ) for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js.

You can differentiate them by finding their version using below code.

node --version

npm --version

Solution 5 - node.js

node is a framework that can run JavaScript code on your machine while npm is a package manager. Using npm we can install and remove javascript packages also known as node modules. Now, it is not a rule that you should use npm to install and remove node modules. We can use yarn also. npm and yarn are capable of the following:

  1. Read and understand package.json file
  2. Download and put javascript modules in node_modules folder.
  3. Run scripts mentioned in package.json such as starting a node server, running in dev and production mode, running scripts for unit testing etc.

Solution 6 - node.js

npm by default run node server.js; if you didn't specify scripts in the package.json

"scripts": {
    "start": "node your-script.js"
}

Which means npm run node

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLijin DurairajView Question on Stackoverflow
Solution 1 - node.jssoueulsView Answer on Stackoverflow
Solution 2 - node.jsbatView Answer on Stackoverflow
Solution 3 - node.jsArunValavenView Answer on Stackoverflow
Solution 4 - node.jsAHAMED AAQIBView Answer on Stackoverflow
Solution 5 - node.jsVIJAYKUMAR REDDY ALAVALAView Answer on Stackoverflow
Solution 6 - node.jsAdeel Raza AzeemiView Answer on Stackoverflow