This is the 10th day of my participation in the August Text Challenge.More challenges in August
Preparation:
Install Node.js
Download from nodejs.org/en/download…
LTS corresponds to the system version. Can LTS be an authenticated version?
Note: Node is the prerequisite for installing YARN. Environment variables are automatically configured after node.js is installed.
To check the version, enter the command node –version
Two, install CNPM (can only use NPM without installing CNPM, CNPM is just faster)
Taobao NPM mirror npm.taobao.org/
Run under the CMD NPM install – g CNPM – registry=https://registry.npm.taobao.org
3. Install YARN (Node.js is the prerequisite for installing YARN)
Website yarn.bootcss.com/
Note: After yarn is installed, environment variables need to be manually configured. The environment variables are automatically configured, but the path command cannot be queried in CMD
Environment variables need to be in effect:
— — — — — —
Take modifying environment variable PATH as an example. After modifying environment variable PATH, enter the DOS command prompt: set PATH=C: to close the DOS window. Open the DOS window again and enter echo %PATH%. You can find that the PATH value in My Computer > Properties > Advanced > Environment Variables has taken effect.
Do not worry that changes in the DOS window will affect the value of the environment variable, which is just a copy of the Windows environment variable. But changes to replicas cause Windows environment variables to refresh!
If you use win+R-> CMD to start cmd.exe, you will find that the environment variables set in the computer properties take effect immediately. If you start CMD in other modes, you will find no effect. !!!!!
After setting environment variables in computer properties, the program and thread started after will take effect, and the program that previously resides in memory does not work, it is also said that kill Explorer. Exe and then start explorer.
It didn’t work, either. You had to restart your computer.
— — — — — —
Check the version. Enter the yarn –version command
4. Install front-end IDE (recommended vscode)
Website code.visualstudio.com/
Download the corresponding system version
After installation:
- 1, install extensions: the left column, see the specific commonly used extensions
- Segmentfault.com/n/133000001…
- 2. User Settings: File – Preferences – Settings overwrite system Settings
- Segmentfault.com/n/133000001…
V. Formal construction of VUE project begins
1. Install vuE-CLI:
NPM install -g@vue /cli or YARN Global add @vue/cli or NPM install -g vue-cli
This command seems to work with or without @, the difference? Have to go to check
2. Create an application:
Vue init webpack my-project or vue create my-project
(The new command on the official website is changed to vue create my-project, but the directory structure is different.)
Error running command:
The command failed: yarn - registry = https://...
A closer look shows that the node version is greater than or equal to……
So reinstall Node.js
3. Install dependency packages:
Json file exists by default. Just install the VUE dependencies: NPM install –save
If you do not have a package.json file or want to reinstall all dependencies, you can recreate package.json by doing the following:
Yarn init or NPM init creates a package.json file
Yarn is yarn install or NPM install –save. Install yarn sequentially using dependencies in package.json
4. Start vUE service:
Go to the root directory of the current project and run the NPM run dev command
The default port 3307 and the default route are automatically enabled through the default browser. You can configure whether to enable the default port and route.
Set the autoOpenBrowser in /config/index.js to true
Error running command:
npm ERR! missing script: dev
Json file, “scripts” property does not have dev, but has serve, new project run command: NPM run serve
5. Vue package deployment:
Go to the root directory of the current project and run the NPM run build command
6. Vue follow-up installation plug-in:
CNPM install chajianming –save-dev specifies dependencies and devDependencies in package.json