Home >Web Front-end >Front-end Q&A >How to install node dependencies in linux
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.
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
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
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"
You can use cnpm -v to check the version, and then operate the relevant process!
Recommended learning: "
node.js video tutorialThe 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!