search
HomeSystem TutorialLINUXDownload the installation path introduction format of nodejsLinux version

1. Download the nodejsLinux version. Note that this tutorial is in .tar.xz format.

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

xz-dnode-xxxx.tar.xz---Extract tar.xz into a tar file

tar-xvfnode-xxxx.tar---Extract the tar file into a folder

mvnode-xxxnodejs----How to install linux by changing the name of the folder to nodejs

[Check whether the installation is successful and execute node-v in the bin directory]

3. Configure soft connections so that the node command can be used globally

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

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

4. Configure /usr/local/src/nodejs/bin to the user environment variable

Switch the current working directory to the user root directory#cd~

View all files, including hidden files#ls-a

Change user environment variable file#vim.bash_profile

Enter i to switch to insert mode, find the PATH variable, and append a comma and the /usr/local/src/nodejs/bin path to the parameter area on one side of it. Press the esc key to exit the output mode, switch to the command mode and enter: wq, save and exit

修改环境变量linux_linux修改环境变量的值_linux修改用户环境变量

PATH=$PATH:

:/usr/local/src/nodejs/bin. . . . . . . .

Immediately execute this modification#source.bash_profile

Globally install module n

npm i -g n

View the help documentation of n template

修改环境变量linux_linux修改用户环境变量_linux修改环境变量的值

If the user environment variable is configured successfully, you can view the help document of the n template, otherwise an error message will appear and the n command cannot be found

n -h

When you forget the specific installation path of node, use the whereis or which command to query

whereis node

5. Configure the node file installation path

Step into the /usr/local/node/path:

修改环境变量linux_linux修改用户环境变量_linux修改环境变量的值

mkdirnode_global

mkdirnode_cache

npmconfigsetprefix"node_global"

npmconfigsetcache"node_cache"

6. When you think npm is slow, you can install cnpm

npminstallcnpm-g--registry=

linux修改环境变量的值_linux修改用户环境变量_修改环境变量linux

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

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

Note: npm does not need to be installed separately. When installing Node, npm will be installed together with it. Moreover, the npm provided with Node may not be the latest version. Finally, use the following command to update to the latest version.

#sudonpminstallnpm@latest-g

The difference between nvm and n is quite big, which is reflected in:

So how to choose the linux command? Different people have different opinions, but here are some general suggestions:

If you use Windows, you have no choice linux modify the user environment variable, use n, or change to a Mac. If you frequently switch node versions (for example, you often test the features of the latest version locally while maintaining code compatibility in the production environment), then from the perspective of global module compatibility, you can only use nvm. If you are a lightweight user who does not need to worry about compatibility issues and is more concerned about the experience of installing and using node, choose n.

If you want to askLinux modification of user environment variables, who did the poster finally choose? I will say, I went with the more popular one.

The above is the detailed content of Download the installation path introduction format of nodejsLinux version. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:ITcool. If there is any infringement, please contact admin@php.cn delete
Warehouse: A GUI for Effortlessly Handling Flatpak AppsWarehouse: A GUI for Effortlessly Handling Flatpak AppsMay 09, 2025 am 11:30 AM

A GUI for Effortless Flatpak Management: Introducing Warehouse Managing a growing collection of Flatpak applications can be cumbersome using only the command line. Enter Warehouse, a user-friendly graphical interface designed to streamline Flatpak a

8 Powerful Linux Commands to Identify Hard Drive Bottlenecks8 Powerful Linux Commands to Identify Hard Drive BottlenecksMay 09, 2025 am 11:03 AM

This article provides a comprehensive guide to identifying and resolving hard drive bottlenecks in Linux systems. Experienced server administrators will find this particularly useful. Slow disk operations can severely impact application performance,

4 Best QR Code Generators for Linux Users4 Best QR Code Generators for Linux UsersMay 09, 2025 am 10:27 AM

Efficient QR code generation tool under Linux system In today's digital world, QR codes have become a way to quickly and conveniently share information, simplifying data access from URLs, texts, contacts, Wi-Fi credentials, and even payment information. Linux users can use a variety of tools to create QR codes efficiently. Let's take a look at some popular QR code generators that can be used directly on Linux systems. QRencode QRencode is a lightweight command line tool for generating QR codes on Linux. It is well-received for its simplicity and efficiency and is popular with Linux users who prefer direct methods. Using QRencode, you can use the URL,

elementary OS 8: A User-Friendly Linux for macOS and Windowselementary OS 8: A User-Friendly Linux for macOS and WindowsMay 09, 2025 am 10:19 AM

Elementary OS 8 Circe: A Smooth and Stylish Linux Experience Elementary OS, a Ubuntu-based Linux distribution, has evolved from a simple theme pack into a fully-fledged, independent operating system. Known for its user-friendly interface, elegant de

40  Linux Commands for Every Machine Learning Engineer40 Linux Commands for Every Machine Learning EngineerMay 09, 2025 am 10:06 AM

Mastering Linux is crucial for any machine learning (ML) engineer. Its command-line interface offers unparalleled flexibility and control, streamlining workflows and boosting productivity. This article outlines essential Linux commands, explained fo

Arch Linux Cheat Sheet: Essential Commands for BeginnersArch Linux Cheat Sheet: Essential Commands for BeginnersMay 09, 2025 am 09:54 AM

Arch Linux: A Beginner's Command-Line Cheat Sheet Arch Linux offers unparalleled control but can feel daunting for newcomers. This cheat sheet provides essential commands to confidently manage your system. System Information & Updates These com

How to Install Scikit-learn for Machine Learning on LinuxHow to Install Scikit-learn for Machine Learning on LinuxMay 09, 2025 am 09:53 AM

This guide provides a comprehensive walkthrough of installing and using the Scikit-learn machine learning library on Linux systems. Scikit-learn (sklearn) is a powerful, open-source Python library offering a wide array of tools for various machine l

How to Install Kali Linux Tools in UbuntuHow to Install Kali Linux Tools in UbuntuMay 09, 2025 am 09:46 AM

This guide explains how to leverage Docker for accessing Kali Linux tools, a safer and more efficient alternative to outdated methods like Katoolin. Katoolin is no longer actively maintained and may cause compatibility problems on modern systems. Do

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.