Install nodejs in compressed package

WBOY
Release: 2023-05-16 21:46:08
Original
987 people have browsed it

With the popularity of Node.js, more and more applications and tools need to use it to run. Installing Node.js itself is not very difficult, but in some cases you may need a faster and easier way to install it, and this is done by installing a tarball.

This article will guide you on how to install Node.js using a compressed package (tarball). This method can help you quickly install Node.js on Linux, Mac and Windows platforms.

  1. Download the compressed package from the Node.js official website

First, you need to download the latest version of the Node.js compressed package from the Node.js official website. Visit https://nodejs.org/en/download/current/ to download the version you need.

Note: Please make sure you download the source code compressed package of Node.js and not the Windows MSI installer.

  1. Decompress the Node.js compressed package

After the download is complete, you need to use the decompression tool to decompress the compressed package to your computer. If you are using Linux or Mac, you can use the following command in the terminal to decompress:

tar -xzf node-v*.*.*-linux-x64.tar.gz
Copy after login

Here, the asterisk represents the version number you downloaded. If you are using Windows, you need to use a decompression tool such as WinRAR or 7-Zip to decompress.

  1. Install Node.js

After the unzipping is complete, you need to install Node.js into your system. Copy Node.js to your /bin directory using the following command:

sudo cp -R node-v*.*.*-linux-x64/* /usr/local/
Copy after login

Here, the asterisk represents the version number you downloaded. When executing this command, make sure you have the correct access rights.

  1. Verify that the installation was successful

After the installation is complete, you need to verify that Node.js has been installed correctly. Enter the following command in the terminal:

node -v
Copy after login

If you can see the version number of Node.js, the installation has been completed successfully.

  1. Configure environment variables

In order to make Node.js available from the command line, you need to add it to your environment variables. Use the following command to configure:

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.profile
Copy after login

This will add Node.js to the PATH environment variable, allowing it to be automatically loaded when opening a new terminal.

  1. Installation Complete

Now, you have successfully installed Node.js using the compressed package. You can verify that it is working properly by entering the following command in the terminal:

node
Copy after login

Now you can use Node.js for system administration, application development, and other tasks.

Summary

Using a compressed package to install Node.js is a quick and easy method for those who need to quickly deploy Node.js. However, when using this method, make sure you have the appropriate permissions and only download Node.js from official sources.

The above is the detailed content of Install nodejs in compressed package. 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