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
What is the salary of Linux administrator?What is the salary of Linux administrator?Apr 17, 2025 am 12:24 AM

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

What is the main purpose of Linux?What is the main purpose of Linux?Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

What is Linux actually good for?What is Linux actually good for?Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

Essential Tools and Frameworks for Mastering Ethical Hacking on LinuxEssential Tools and Frameworks for Mastering Ethical Hacking on LinuxApr 11, 2025 am 09:11 AM

Introduction: Securing the Digital Frontier with Linux-Based Ethical Hacking In our increasingly interconnected world, cybersecurity is paramount. Ethical hacking and penetration testing are vital for proactively identifying and mitigating vulnerabi

How to learn Linux basics?How to learn Linux basics?Apr 10, 2025 am 09:32 AM

The methods for basic Linux learning from scratch include: 1. Understand the file system and command line interface, 2. Master basic commands such as ls, cd, mkdir, 3. Learn file operations, such as creating and editing files, 4. Explore advanced usage such as pipelines and grep commands, 5. Master debugging skills and performance optimization, 6. Continuously improve skills through practice and exploration.

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools