Home > Web Front-end > JS Tutorial > Node.js non-installation configuration method

Node.js non-installation configuration method

一个新手
Release: 2017-09-20 10:56:37
Original
1438 people have browsed it

In general development, we will directly reference the jdk package by configuring JAVA_HOME instead of reinstalling a jdk.exe. So can nodejs be installed in the same way?
Of course, otherwise I wouldn’t be writing this blog. Okay, enough nonsense, let’s go to the tutorial
First download the non-installation version of nodejs. Of course, you can also install it first, and then copy the installed Nodejs folder. You can always use this folder in the future and configure the environment variables. , instead of reinstalling it every time
First, configure NODE_PATH. Note here that NODE_PATH needs to be configured with two values
1. Configure the physical path of the Nodejs folder
2. Configure to the folder Nodejs\node_global\node_modules
Configure NODE_PATH: D:\myEvn\tools\Nodejs\node_global\node_modules;D:\myEvn\tools\Nodejs
Node.js non-installation configuration method

Then configure Path, two items need to be configured here as well
1. Configure the physical path of the Nodejs folder like NODE_PATH
2. Configure Nodejs global variable address
Configure Path: D:\myEvn\tools\Nodejs;D:\myEvn\tools\Nodejs\node_global
Node.js non-installation configuration method
Configuring Path, we may take it for granted like Configure %JAVA_HOME%\bin like configuring JAVA. In fact, this is one of the pitfalls. What really works are the two addresses configured in the path environment variable (there is no way to configure variables like NODE_HOME, because there is no such thing as \bin a folder), what is executed in the command is the XX.cmd file under the two paths configured by this path, and then the downloaded resources are placed in NODE_PATH

Modify the global variables and cache address, open Command prompt (win+r and enter cmd)
Modify global variables, enter

npm config set prefix “D:\myEvn\tools\Nodejs\node_global”
Copy after login

to modify the cache storage location, enter

npm config set cache “D:\myEvn\tools\Nodejs\node_cache”
Copy after login

to view the global variable address
View the global variable address, enter

npm config get prefix
Copy after login

Result:
Node.js non-installation configuration method
View cache address, enter

npm config get cache
Copy after login

Result:
Node.js non-installation configuration method

Verify installation

npm -v
Copy after login

Node.js non-installation configuration method

OK, the configuration here completes all the configuration of Nodejs

The above is the detailed content of Node.js non-installation configuration method. 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