Because of the use of gulp 3 to develop projects, gulp 3 does not support nodejs 12 or higher, and there are many changes in gulp 4 syntax, so I plan to use nvm-windows for version management, so that multiple nodejs can be manipulated on this machine Version now.
In particular, n and nvm are both version managers under mac or linux, and they cannot be used under windows, and nvm-windows is not a simple porting of nvm, depending on the developer's own statement.
Uninstall the original nodejs
- To install nvm, you must uninstall the existing nodejs, if you have never installed nodejs, it’s okay
To uninstall, you only need to select uninstall in the nodejs folder. I have seen some articles, which directories and environment variables need to be cleared. From my practice, I can successfully install without doing so.
Download nvm-windows
Download on the official website: download link
It is best to choose this version to download
and install it after downloading.
After the installation is complete, enter nvm -v in the console, and the version number can be displayed, indicating that the nvm installation is successful
Download nodejs and npm
It is best to set up a domestic mirror before downloading, otherwise the download speed will be very slow even if I hang clash
Enter where nvm in the console to view the directory of nvm.
Enter the directory, find
settings.txt and add Taobao mirror to settings.txt
node_mirror: https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/
The mirror configuration is now complete
Enter nvm list in the console, you can view the version of nodejs that has been installed, if it is not installed, it will display no.
Enter nvm list available in the console to view the current versions that can be installed
For example, I chose to install 12.20.1
nvm install 12.20.1
after the installation is complete, and then select the version, nvm use 12.20.1, npm will automatically install during this period.
At this time, enter node -v and npm -v to display the version number success
If it shows that node is not an internal or external command, configure the installation path of nodejs in nvm in the environment variable.