How to Install Node.js and npm on Debian 11 |Holhol24

5

Node.js is an open-source, cross-platform JavaScript runtime surroundings for creating server-side programs.

Node.js makes use of an event-driven, non-blocking I/O fashion that makes it light-weight and environment friendly, best for data-intensive real-time programs that run throughout disbursed gadgets.

Here, we can see the best way to set up Node.js on Debian 11.

Install Node.js on Debian

You can set up Node.js the use of NodeSource, NVM, and Debian repository. So, observe any one of the most strategies you suppose is more straightforward to put in Node.js.

You would possibly wish to set up the curl bundle prior to continuing additional.

sudo apt replace && sudo apt set up -y curl

Install Node.js the use of NodeSource

Nodesource is a number one business undertaking device corporate with a venture to construct and toughen a sustainable open supply group round Node.js, JavaScript, and NPM.

At the time of writing this text, the underneath variations of Node.js is to be had for consumer. You can discuss with the professional web page to search out the supported Node.js variations.

  • v14.x (Active LTS)
  • v12.x (Maintenance LTS)
  • v16.x (Latest Version)

v14.x (LTS)

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -

sudo apt set up -y nodejs

v12.x (LTS)

curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -

sudo apt set up -y nodejs

v16.x

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

sudo apt set up -y nodejs

Install Node.js the use of NVM

nvm is a model supervisor for Node.js, and it is helping us set up Node.js consistent with consumer and invokes it consistent with shell. Also, it lets you set up and use a couple of variations of node.js in parallel.

Install nvm through working the underneath command.

curl -o- https://uncooked.githubusercontent.com/nvm-sh/nvm/v0.38.0/set up.sh | bash

Once the nvm is put in, go out the present consultation and log in again to make use of the nvm command.

Use the underneath command to make sure the nvm set up.

nvm -v

Output:

0.38.0

Now, you’ll be able to use the nvm command to put in the newest strong model of Node.js, the newest LTS model, a selected model of Node.js.

# Latest Stable Version

nvm set up node

# Latest LTS Version

nvm set up --lts

# Specific Version

nvm set up 12.22.5

Use nvm ls-remote to checklist the to be had Node.js model to put in, nvm use node/--lts/ to modify to every other Node.js model, nvm alias default to set the default Node.js model.

Install Node.js the use of Debian Repository

Node.js could also be to be had within the Debian repository, and you’ll be able to set up it along side npm (Node Package Manager)the use of the underneath command.

Node.js v12.x (LTS) and npm v7.5.x are to be had within the Debian OS repository when writing this text.

sudo apt set up -y nodejs npm

Check Node.js Installation

Check the Node.js model the use of the next command.

node -v

Output: (NodeJS v14.x)

v14.17.5

Check the npm model.

npm -v

Output:

6.14.14

Install Build Tools

You will wish to set up building gear to collect and set up local addons from npm.

sudo apt set up -y build-essential

Conclusion

That’s All. I am hoping you will have discovered the best way to set up Node.js on Debian 11.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More