Home  >  Article  >  Web Front-end  >  arm64 install nodejs

arm64 install nodejs

WBOY
WBOYOriginal
2023-05-27 21:21:362113browse

In macOS, Linux, Windows and other systems, installing Node.js is very simple. You only need to download the corresponding installation package and then install it "foolishly" all the way. However, on ARM64-based devices, installing Node.js is a little more complicated. This article will introduce the detailed steps to install Node.js on ARM64 architecture devices.

First of all, we need to make it clear that there is an important difference between ARM architecture devices and x86 architecture devices: the latter is based on Intel processors and AMD processors, while the former is based on ARM processors. Since most developers use x86 architecture devices, most Node.js releases are optimized for the x86 architecture. Therefore, installing Node.js on ARM64 architecture devices requires some additional steps.

Step 1: Install dependencies

Before installing Node.js, we need to install some necessary dependency libraries:

sudo apt-get update
sudo apt -get install -y gcc g make

Here we take Ubuntu as an example. If you are using other Linux distributions, you can install it according to the corresponding commands.

Step 2: Download the binary file

We can download the ARM architecture binary file from the official website of Node.js. Choose the appropriate version and download it.

Step 3: Decompress the file

After the download is complete, we need to decompress it, select a suitable directory, and decompress the compressed file into that directory.

mkdir ~/nodejs
cd ~/nodejs
tar -xf node-v14.16.1-linux-arm64.tar.xz

Here, we unzip it to Under the "~/nodejs" directory.

Step 4: Set environment variables

We need to add the path of Node.js to the environment variable in order to use Node.js commands directly on the command line.

Edit the "~/.bashrc" file:

nano ~/.bashrc

Add the following code at the end of the file:

export PATH=$HOME /nodejs/node-v14.16.1-linux-arm64/bin:$PATH

Here, we add the path of Node.js to the environment variable.

Step 5: Check the installation

Now, we have completed the installation of Node.js. We can use the following command to check whether Node.js is installed successfully:

node -v

If you see the Node.js version number output, it means the installation has been successful.

Summary

Installing Node.js on ARM64 architecture devices is more complicated than on x86 architecture devices, but it is not too difficult. We only need to perform the above five steps to complete the installation. After successful installation, we can enjoy using Node.js on ARM64 architecture devices.

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

Statement:
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