apt install nodejs

WBOY
Release: 2023-05-11 21:28:07
Original
2282 people have browsed it

aptInstall Node.js

Node.js is an open source, cross-platform, runtime environment that uses an event-driven, non-blocking I/O programming model. It was introduced by Ryan Dahl in 2009 Created in year.

On Ubuntu or Debian systems, we can use the apt package manager to install Node.js. This article will introduce how to install Node.js using apt package manager on Ubuntu or Debian system.

  1. Update package cache

Before installing Node.js, we need to update the system's package cache. Enter the following command in the terminal:

sudo apt update
Copy after login
  1. Install Node.js

On Ubuntu or Debian systems, we can use the NodeSource repository to install Node.js. We need to add the NodeSource repository to our system. Enter the following command in the terminal:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
Copy after login

In the above command, 12.x represents the Node.js version we want to install. If you need to install another version, please replace 12.x with another version number.

Next, we can use the following command to install Node.js:

sudo apt install -y nodejs
Copy after login

The above command will install nodejs and npm.

  1. Verify Node.js installation

After completing the installation, we can use the following command to verify whether Node.js has been installed successfully:

node -v
Copy after login

If After successful installation, it will output the version number of Node.js. For example: v12.8.3.

We can also use the following command to verify whether npm has been installed successfully:

npm -v
Copy after login
Copy after login

It will output the version number of npm. For example: 6.10.3.

  1. Update npm

After completing the installation of npm, we can use the following command to update npm to the latest version:

sudo npm install -g npm
Copy after login

Next, we can use The following command is used to verify whether npm has been updated to the latest version:

npm -v
Copy after login
Copy after login

If the update is successful, it will output the latest version number of npm.

Summary

It is very convenient to install Node.js using apt. You can complete the installation process by entering a few commands in the terminal. I hope this article can provide you with some valuable information to facilitate the installation and configuration of Node.js on your own machine.

The above is the detailed content of apt install nodejs. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template