Table of contents
3. Test whether the installation is successful
5. Test whether the configuration environment is successful
1. Create your own working directory
8. Various configuration file matching problems arise
1. Download
If you want to choose other versions or other systems, just go to the selection below and download the installation package:
ps: In fact, if you later use the nodejs version 14.15.5 corresponding to the project, you can directly choose other versions and find the corresponding 14.15.5
2. Installation
Double-click the installation package
Everyone has their own preferences regarding the installation path, so make your own decision:
By default, nodejs dependent modules are installed on the C drive . As development work progresses, more and more nodejs modules are relied on, which will lead to insufficient space on the C drive. Therefore, the author usually recommends installing nodejs dependent modules in other disk directories to save C drive. disk space.
Do not select, click next to install
3. Test whether the installation is successful
Press the [win+R] keys, enter cmd, and open the cmd window
Input: node -v // Display node.js version
npm -v // Display npm version
The version description is successfully displayed and the installation is successful.
4. Configuration environment
Recommend a domestic chatgpt - Wen Xinyiyan
Why do you need environment configuration after installing nodejs?
The purpose of environment configuration is mainly to change the download location for installing NodeJS dependencies to facilitate future management.
(1) Find the installation directory and create two new folders [node_global] and [node_cache] in the installation directory.
This will pop up when creating a new folder, just continue.
(2) After creation, open the cmd command window as an administrator
Note that you must run it as an administrator, otherwise problems may occur if you configure it later. I jumped into the trap and installed it twice. Therefore, the following paths may be different, and you need to understand them by yourself.
npm config set prefix "E:\nodejs\node_global"
npm config set cache "E:\nodejs\node_cache"
(3) Configure environment variables
①[This PC]-right-click-[Properties]-[Advanced System Settings]-[Environment Variables]
② Click [New] in [System Variables]
If there is no [node_modules] folder under the [node_global] you just created, manually create a [node_modules] folder, and then copy the path address of the [node_modules] folder you created to the variable value
③Edit [Path] in [User Variables]
④Change AppData\Roaming\npm
the default [ ] under C drive to [ node_global】的路径
, click OK.
⑤Select [Path] in [System Variables], click [Edit] to add [NODE_PATH], and then keep clicking [OK]
5. Test whether the configuration environment is successful
After the configuration is completed, enter cmd with win+r, and then globally install a most commonly used express module for testing. -g represents global installation.
npm install express -g
If the following appears, the creation failed! ! !
method:
Modify the permissions of [nodejs] and [node_global]. I modified the permissions of the nodejs file.
Steps: Right-click the [node_global] folder, click [Properties], then click [Security], then click [Edit], check all permissions, and then click [OK].
So according to the prompt, it is a permissions issue. The reason is that I installed it myself in the [Program Files] folder, so from the time I created the folder above, it appears that administrator permissions are required. If you change the path, there should be no similar problems. questionable.
If the following appears, it is successful
6. Install Taobao image
npm config set registry https://registry.npm.taobao.org
Check if successful
npm config get registry
Install cnpm
npm install -g cnpm --registry=https://registry.npmmirror.com
Check if the installation is successful
cnpm -v
The following content appears. Congratulations, you succeeded.
7. Get started quickly
1. Create your own working directory
Method 1: Change the path in cmd when using it, and change the default c path to the working directory you created.
Method 2: Recommended
Go directly to your folder, click on the path, enter cmd, and you will be there directly.
2. Download the working code
Download code resource URL
Enter in cmd, pay attention to the previous path.
git clone https://gitee.com/sendya/ant-design-pro-vue.git
After downloading, you will have these contents in your working folder.
At this point, the entire project is available, open it with vs, or other commands.
View the contents of the project:
8. Various configuration file matching problems arise
In fact, this project corresponds to nodejs 14.15.5. You can directly download and install this version in the first step.
Otherwise, you need to operate the upgrade and downgrade of the file: (The operation is roughly as follows, just modify according to the error message)
When running the operation, there is also a version matching issue. You can match eslint
the version in the project with eslint-plugin-vue
the required eslint
version compatibility issue.
You can choose to upgrade eslint-plugin-vue
npm uninstall eslint-plugin-vue
npm install eslint-plugin-vue
9. Summary
The trap is gone, and I finally uninstalled and installed it skillfully.
Change the path to the project
dir#View project files
npm install #Download configuration file package, etc.
npm run serve #Run
There is still a problem in operation, please check again next time.