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.
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.
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
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
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
After decompression, you will get a folder named node-v14.16.0.
Enter the unzipped folder and execute the following command in the terminal:
./configure
This command will check your system environment , and generate a Makefile. If an error occurs, verify that your system has all required dependencies installed.
Execute the following command in the terminal:
make
This command will compile Node.js. The entire process may take some time, depending on your machine capabilities and Node.js version.
Execute the following command in the terminal:
sudo make install
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.
Run the following command to verify that you have successfully installed Node.js:
node -v
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!