Table of Contents
Step 1: Install Node.js
Step 2: Install the Node.js package manager - npm
Conclusion
Home Web Front-end Front-end Q&A nodejs download and install Linux

nodejs download and install Linux

May 13, 2023 pm 04:30 PM

Node.js is a JavaScript runtime based on the Chrome V8 engine, which allows the JavaScript runtime environment to be extended to the server side. It effectively solves the problem of inconsistency between front-end and back-end languages, allowing front-end developers to use JavaScript for full-stack development.

This article will introduce how to download and install Node.js on a Linux system.

Step 1: Install Node.js

In order to install Node.js on Linux, you first need to download it from the Node.js official website [https://nodejs.org](https:// nodejs.org/) to download the latest version of Node.js installation files.

Enter the download directory through the terminal and decompress the download file:

cd ~/Downloads
tar -xvf node-v14.15.3-linux-x64.tar.xz
Copy after login

The above command assumes that you are already in the download directory and have downloaded the installation file of Node.js version 14.15.3. Please make corresponding modifications according to the version number of the file you downloaded.

After decompression is completed, move the Node.js directory to the /usr/local/ directory:

sudo mv node-v14.15.3-linux-x64 /usr/local/
Copy after login

Next, set the Node.js environment variable through the following command:

export PATH=$PATH:/usr/local/node-v14.15.3-linux-x64/bin
Copy after login
Copy after login

In order to permanently save the environment variables, you need to add the above command to the end of the ~/.bashrc file:

sudo nano ~/.bashrc
Copy after login

Add the following content in the .bashrc file:

export PATH=$PATH:/usr/local/node-v14.15.3-linux-x64/bin
Copy after login
Copy after login

After the addition is completed, save and Exit the .bashrc file and reload the environment variables via the following command:

source ~/.bashrc
Copy after login

Now Node.js has been successfully installed and can be verified via the node command:

node -v
Copy after login

The above command will output on that system Version information for Node.js.

Step 2: Install the Node.js package manager - npm

The Node.js package manager npm allows users to easily download and manage Node.js modules. After installing Node.js, npm is installed by default.

The following command can check the version information of npm:

npm -v
Copy after login

If the version information is output, it means that npm has been successfully installed.

Conclusion

Installing Node.js on a Linux system is very easy. First download the latest version of the binary file from the Node.js official website, then unzip it to the appropriate directory and add it to the system's PATH. Next, you can use the node and npm commands in the terminal to operate and manage the Node.js environment.

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

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

Hot Article

Hot Article

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain the concept of lazy loading. Explain the concept of lazy loading. Mar 13, 2025 pm 07:47 PM

Explain the concept of lazy loading.

How does the React reconciliation algorithm work? How does the React reconciliation algorithm work? Mar 18, 2025 pm 01:58 PM

How does the React reconciliation algorithm work?

What is useEffect? How do you use it to perform side effects? What is useEffect? How do you use it to perform side effects? Mar 19, 2025 pm 03:58 PM

What is useEffect? How do you use it to perform side effects?

How does currying work in JavaScript, and what are its benefits? How does currying work in JavaScript, and what are its benefits? Mar 18, 2025 pm 01:45 PM

How does currying work in JavaScript, and what are its benefits?

What are higher-order functions in JavaScript, and how can they be used to write more concise and reusable code? What are higher-order functions in JavaScript, and how can they be used to write more concise and reusable code? Mar 18, 2025 pm 01:44 PM

What are higher-order functions in JavaScript, and how can they be used to write more concise and reusable code?

Explain the purpose of each lifecycle method and its use case. Explain the purpose of each lifecycle method and its use case. Mar 19, 2025 pm 01:46 PM

Explain the purpose of each lifecycle method and its use case.

What are React's performance optimization techniques (memoization, code splitting, lazy loading)? What are React's performance optimization techniques (memoization, code splitting, lazy loading)? Mar 18, 2025 pm 01:57 PM

What are React's performance optimization techniques (memoization, code splitting, lazy loading)?

What is useContext? How do you use it to share state between components? What is useContext? How do you use it to share state between components? Mar 19, 2025 pm 03:59 PM

What is useContext? How do you use it to share state between components?

See all articles