Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing nodejs Environment and path configuration in Linux

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "Linux installation nodejs environment and path configuration". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Linux there are two ways to install nodejs: one is simple, unzipped, and the other is installed by downloading source code, compiling, and make,make install commands.

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

First, determine which linux system you are using, and then download the response package. What I downloaded here is node-v6.11.2-linux-x64.tar.xz

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

Xz-d node-xxxx.tar.xz-decompress tar.xz into 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

Third, check whether the installation can be successful

Configure the soft connection so that the node command 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

Configure the installation path of node files

Enter the / usr/local/node/ path:

Mkdirnode_global

Mkdirnode_cache

Npm config set prefix "node_global"

Npm config set cache "node_cache"

When you think npm is slow, you can install cnpm

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

By the way, you can check that the global installation of-g is installed in the node_global file as previously set.

Use cnpm globally as follows, and remember to configure a soft connection as well.

This is the end of the content of "how to install nodejs environment and path configuration for Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 253

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report