Detailed steps for installing nodejs environment and path configuration in Linux

Detailed steps for installing nodejs environment and path configuration in Linux

There are two ways to install nodejs in linux. One is simple, just unzip it and use it; the other is to download the source code, compile it, and install it through make and make install commands.

Here we only talk about the first one, which is simple and convenient. There is no need to execute make or make install. Here are the steps:

1. Determine the Linux system you are using, and then download the corresponding compressed package. Here I downloaded node-v6.11.2-linux-x64.tar.xz

2. Upload to the Linux related path, usually /usr/local/, and execute the following command

xz -d node-xxxx.tar.xz --- Extract tar.xz into a tar file

tar -xvf node-xxxx.tar --- Extract the tar file into a folder

mv node-xxx node ----Change the name of the folder to node

3. Check whether the installation is successful

4. Configure soft links so that node commands can be used globally

ln -s /usr/local/node/bin/node /usr/bin/node --map the node source file to the node file under usr/bin

ln -s /usr/local/node/bin/npm /usr/bin/npm

5. Configure the node file installation path

Enter the /usr/local/node/ path:

mkdirnode_global

mkdirnode_cache

npm config set prefix "node_global"

npm config set cache "node_cache"

6. When you feel that npm is slow, you can install cnpm

npm install cnpm -g --registry=https://registry.npm.taobao.org

By the way, you can check whether the global installation -g is installed in the node_global file according to the previous settings.

To use cnpm globally as follows, remember to configure a soft link.

This is the end of this article about installing nodejs environment and path configuration in Linux. For more relevant content about installing nodejs in Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Install nodejs in binary mode under linux
  • Tutorial on installing nodejs & npm and configuring global paths in Linux Centos7.2
  • How to install nodejs and npm under linux

<<:  mysql IS NULL using index case explanation

>>:  How to write a picture as a background and a link (background picture plus link)

Recommend

Best tools for taking screenshots and editing them in Linux

When I switched my primary operating system from ...

Learn about JavaScript closure functions in one article

Table of contents Variable Scope The concept of c...

Vue3 AST parser-source code analysis

Table of contents 1. Generate AST abstract syntax...

The presentation and opening method of hyperlink a

<br />Related articles: How to prompt and op...

Detailed explanation of the use of MySQL Online DDL

Table of contents text LOCK parameter ALGORITHM p...

How to install Maven automatically in Linux continuous integration

Unzip the Maven package tar xf apache-maven-3.5.4...

Analysis and solution of MySQL connection throwing Authentication Failed error

[Problem description] On the application side, th...

MySQL index coverage example analysis

This article describes MySQL index coverage with ...

Nginx location matching rule example

1. Grammar location [=|~|~*|^~|@] /uri/ { ... } 2...

Scoring rules of YSlow, a webpage scoring plugin developed by Yahoo

YSlow is a page scoring plug-in developed by Yaho...

MySQL 8.0.22 winx64 installation and configuration graphic tutorial

mysql 8.0.22 winx64 installation and configuratio...