Nvm installs node, the node command can be found, the npm command cannot be found, the npm.cmd under the npm folder can be found, the npm-cli.js module cannot be found, do you need to configure NPM environment variables? I have configured npm_HOME, but I still cannot find the NPM command. Ask the great god to dispel doubts.
:: Created by npm, please don't edit manually. @ECHO OFF SETLOCAL SET "NODE_EXE= percentage ~dp0\node.exe " IF NOT EXIST "percentage NODE_EXE percentage" ( SET "NODE_EXE=node" ) SET "NPM_CLI_JS= percentage ~ dp0 \ node _ modules \ npm \ bin \ npm-cli.js " For/f "deltims =" percentage fiin ('call' percentage NODE_EXE percentage ""percentage NPM_CLI_JS percentage "prefix -g') DO ( SET "NPM_PREFIX_NPM_CLI_JS= percentage percentage f \ node _ modules \ npm \ bin \ npm-cli.js " ) Ifexit "percentage NPM_PREFIX_NPM_CLI_JS percentage" ( SET "NPM_CLI_JS= percentage NPM_PREFIX_NPM_CLI_JS percentage " ) "Percent NODE_EXE Percent," "Percent NPM_CLI_JS Percent" Percent *
The above is the code of npm.cmd
The above image shows the folder where npm is located.
The above figure shows the configured npm_home environment variable
The figure above shows the path configuration.
The main key solution: = = = “applies to the installation of everything
Install the software related to environment configuration class and others. In general, remember not to install it under the C-disk programfiles. Otherwise, errors will be reported for various problems! ! ! Remember!
Nvm installation steps:
1. download nvm-setup installation package
2. Open the installation package and select the storage path of nvm and nodejs. Remember not to select c:/program files here. The two paths here are for automatically adding environment variables to the system.
3. Open the settings.txt file under the nvm folder and add the following code at the end:
node_mirror: https://npm.taobao.org/mirrors/node/ npm_mirror: https://npm.taobao.org/mirrors/npm/
Point the download mirror source to Taobao (this step is also very important, otherwise when installing node, you will get stuck and npm installation will not succeed)
4. open cmd, nvm install v version number,
5. nvm use version number
6. node -v,npm -v check whether node was successfully installed.
Node folder screenshot after installation:
If the node version is not selected after nvm use or other situations occur, then uninstall nvm and reinstall to continue the test!