Home > Web Front-end > Front-end Q&A > How to install node dependencies in linux

How to install node dependencies in linux

藏色散人
Release: 2021-12-13 11:12:40
Original
2605 people have browsed it

How to install node dependencies on Linux: 1. Download Node; 2. Place the downloaded software package in the /usr/local/src directory; 3. Execute "ln -s /usr/local/src/ node-v8.10.0-linux-x64/bin/node" command.

How to install node dependencies in linux

The operating environment of this article: linux5.9.8 system, nodejs v8.10.0 version, Dell G3 computer.

linux How to install node dependencies?

Installing node and npm on Linux

Note: Recently, I need to use the react front-end framework in my work so that it can be separated from the front and back. Before installing react, I was You need to install node and npm first. Since npm depends on node, as long as I install node, npm will be installed!

1. Download Node

Official website download link: https://nodejs.org/zh-cn/download/

 

 Me Here is to put the downloaded software package in the /usr/local/src directory

to pressurize the Node. Since the node downloads the package that has already been executed, So there is no need to do any execution operations here;

Here we can see that there is a node and npm in the bin directory, which shows that it has been installed.

If you want to use npm and node globally, you need to make relevant soft links, as follows!

Enter the /usr/local/bin directory and execute the following command

[root@localhost bin]# ln -s /usr/local/src/node-v8.10.0-linux-x64/bin/npm
[root@localhost bin]# ln -s /usr/local/src/node-v8.10.0-linux-x64/bin/node
Copy after login

At this time, you will see the following status

Then You can execute node -v npm -v at any location to view the corresponding version, and the installation is complete!

2. Use Taobao mirror

Execute the following command

npm config set registry https://registry.npm.taobao.org
Copy after login

Or view Taobao mirror resources: https://npm.taobao.org/

Execute The following command:

alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
Copy after login

You can use cnpm -v to check the version, and then operate the relevant process!

Recommended learning: "

node.js video tutorial

"

The above is the detailed content of How to install node dependencies in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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