Home > Web Front-end > Front-end Q&A > How to install nodejs manually

How to install nodejs manually

PHPz
Release: 2023-04-05 09:19:58
Original
680 people have browsed it

Manual installation of Node.js

Node.js is a fast and highly scalable JavaScript runtime that helps developers write high-performance applications. Installation of Node.js is very simple, just download and execute the installer. However, some developers prefer to install Node.js manually because it provides more flexibility and control. This article will guide you through installing Node.js manually.

  1. Download source file

Node.js is open source, and you can get the source code from the Node.js official website. Go to https://nodejs.org/en/download/releases/ page to download the version you need. You can download the stable version or the latest version according to your needs. It is recommended to download LTS (Long Term Support) versions as these versions provide more stable performance and security.

  1. Prepare the installation environment

Before installation, please ensure that your system has the compilation tools and related dependencies installed. For Linux systems, please use the following command to install dependencies:

sudo apt-get update
sudo apt-get install -y build-essential libssl-dev
Copy after login

For MacOS systems, you need to install Xcode and Xcode Command Line Tools. You can download and install Xcode from the Mac App Store, then execute the following command in the terminal:

xcode-select --install
Copy after login
  1. Extract the source code

Extract the downloaded source code zip file to the target folder. For example, execute the following command in the terminal of the Linux system:

tar -xvf node-v14.16.0.tar.gz
Copy after login

After decompression, you will get a folder named node-v14.16.0.

  1. Configuration

Enter the unzipped folder and execute the following command in the terminal:

./configure
Copy after login

This command will check your system environment , and generate a Makefile. If an error occurs, verify that your system has all required dependencies installed.

  1. Compile

Execute the following command in the terminal:

make
Copy after login

This command will compile Node.js. The entire process may take some time, depending on your machine capabilities and Node.js version.

  1. Installation

Execute the following command in the terminal:

sudo make install
Copy after login

This command will install Node.js to the default installation path of the system. You can now run the node command in the terminal to start Node.js.

  1. Verification

Run the following command to verify that you have successfully installed Node.js:

node -v
Copy after login

This command will display the version of Node.js number, indicating that the installation was successful.

Summary

Manually installing Node.js requires a few extra steps, but it provides more flexibility and control. This article has shown you the process of installing Node.js manually. If you encounter any problems, please refer to the official documentation or ask for help in the community.

The above is the detailed content of How to install nodejs manually. 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