当前位置:网站首页>Under the NVM node installation;The node environment variable configuration

Under the NVM node installation;The node environment variable configuration

2022-08-09 23:44:00 m0_67393828

1, nvm installation

1. Double-click the installation file nvm-setup.exe

2. Select the nvm installation path

3. Select the nodejs path

4. Confirm the installation

5. Confirmation after installation

Open CMD and enter the command nvm , the installation is successful and the display is as follows.You can see that various commands are listed, and the Chinese instructions for these commands will be listed at the end of this section.
insert image description here

6. nvm manages node version

1. View all installable versions

nvm list available

2. View all locally installed versions

nvm list

3, installation, the version number in the command

nvm install 14.18.1

4. Use the specified node version

nvm use 14.18.1

5. Uninstall

nvm uninstall 14.18.1

7. Other nvm related commands

nvm arch : Shows whether node is running in 32-bit or 64-bit.nvm install  [arch] : Install node, version is a specific version or the latest stable version latest.The optional parameter arch specifies whether to install the 32-bit or 64-bit version, and the default is the system bit.You can add --insecure to bypass the remote server's SSL.nvm list [available] : Displays a list of installed ones.The optional parameter available, displays all versions that can be installed.list can be simplified to ls.nvm on : Enable node.js version management.nvm off : Turn off node.js version management.nvm proxy [url] : Set download proxy.Without the optional parameter url, the current proxy is displayed.Setting url to none removes the proxy.nvm node_mirror [url] : Set the node mirror.The default is https://nodejs.org/dist/.If no url is written, the default url is used.After setting, you can view the settings.txt file in the installation directory, or operate directly in this file.nvm npm_mirror [url] : Set npm mirror.https://github.com/npm/cli/archive/.If no url is written, the default url is used.After setting, you can view the settings.txt file in the installation directory, or operate directly in this file.nvm uninstall  : Uninstall the specified version of node.nvm use [version] [arch] : Use the specified version of node.32/64 bits can be specified.nvm root [path] : Set the directory where different versions of node are stored.If not set, the current directory is used by default.nvm version : Displays the nvm version.version can be simplified to v.

2, node.js installs a version not in the nvm list

1. Download the required node version

2. Create a relevant version folder in the nvm installation path

3. Double-click to install the node file

4. Install into the version folder created in the nvm folder

6. Check if the version is installed

insert image description here

7. View the current node version

node -v

3, node environment variable configuration

1. First, create two new folders node_global and node_cache in the installation directory of node.js

insert image description here

2. After creating the two folders, enter the following commands in the cmd window (the two paths are the paths of the two folders):

npm config set prefix "D:installodejsode_global"npm config set cache "D:installodejsode_cache"

3. Next, set the computer environment variables, right-click "My Computer" = "Properties =" Advanced System Settings = "Environment Variables" to enter the following environment variables dialog box.

insert image description here

4. Create a new environment variable NODE_PATH in [System Variables] with the value D:install odejs ode_global ode_modules, where D:install odejs ode_global is the global module installation path folder created above

insert image description here

5. Modify the path variable in [User Variables], and change C:UsershuaAppDataRoaming pm to D:install odejs ode_global

insert image description here
insert image description here

6. After clicking OK, the configuration is complete.

7. Test whether the configuration is successful, enter the following in the cmd window to specify the global installation of the express module

npm install -g express # -g means global installation

[The external link image transfer failed, the origin site may have an anti-leech mechanism, it is recommended to save the image and upload it directly (img-WEpTS7x3-1652185237994)(pictures/8782952-559fa6868c6d1a16.png)]

insert image description here

8. Domestic mirror website configuration

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

9. When downloading modules in the future, replace npm with cnpm to download modules from Taobao mirrors, for example

cnpm install

Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials

原网站

版权声明
本文为[m0_67393828]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208092000354956.html