Vue project hot deployment-environment configuration
- First open the official website of node.js https://nodejs.org/en/
- Click DOWNLOADS
- LTS is a long-term maintenance version, and Current is the latest version. We generally choose LTS
- Choose your own corresponding system to install it. Fool-like next installation.
- cmd enters the running interface, and check whether the installation is successful through two commands. Npm is a tool that comes with node when downloading.
Registration code cloud
-
https://gitee.com/ is used to put our code, or to work better at work.
-
Create the project.
-
To create a warehouse, the license is generally MIT.
-
The warehouse has been built.
-
But if you want to remotely connect to the local warehouse, you must download git locally-https://git-scm.com/downloads, and select the version of your system.
-
Open cmd, enter git --version
-
Enter the git warehouse to open the settings, and you must get through offline and online.
-
Click SSH public key, how to generate a public key is based on Linux. Windows is different.
Windows is the desktop right click with a Git Bash, which is equivalent to entering the Linux terminal-a small Linux. So the execution command must be entered inside, not cmd.
-
Generate a public key, ssh-keygen -t rsa -C "xxx", and press Enter.
-
Check the public key again. Type cat ~/.ssh/id_rsa.pub
-
Copy the public key into your ssh settings. Wait a while
-
Back in the warehouse, now we are going to clone our online warehouse to our offline. Click ssh, copy.
-
If it is linux, cd to a local folder, enter git clone [email protected]:luobinhua/travel.git, then if it is windows, enter a folder first.
Enter git clone [email protected]:luobinhua/travel.git.
Install Vue
You can check here for better. https://cli.vuejs.org/
- Install vue-cli globally: Command-npm install --global vue-cli
- Note: If there is an error, it may be the previous version, the error is as follows.
Solution: https://blog.csdn.net/XQXOI/article/details/110818582
My solution
npm uninstall @vue/cli -g remove the new scaffolding global tool
npm install vue-cli -g install the old scaffolding
If the download is slow, you can use Taobao mirror to help us install cnpm
npm install cnpm -g --registry= https://registry.npm.taobao.org
download code: cnpm install vue-cli -g
-
To create a packaged project, the command—vue init webpack my-project, where my-project refers to the folder under the specified current directory—the folder where the project is to be placed.
The following is as follows: -
Install vie-router? Do you need to route Y
-
Use EsLint to lint your code? Whether to check the fairness of the code Y
-
Pick an ESLint preset code detection specification Standard
-
Set up unit tests whether to perform unit tests no
-
Setup e2e tests with Nightwatch? An end-to-end test no
-
Should we run
npm install
for you after the project has been created? (recommended) Whether to use NPM or Yarn tools for management. Yes, use NPM -
If something goes wrong. You can use npm install -g @vue/cli-init. The reason for the error is because you downloaded vue3.0 but want to use vue2.0, you can use this command to overwrite it.
-
Go to the downloaded folder. cmd runs npm run dev to start.
If there is an error, you can select the white box that appears in the error message, press Enter, and then paste it in the translation, and copy the fourth last sentence to Baidu search (precisely found the bug). If you have the following problem with me, then it is
local The package.json already exists, but the node module does not? People will remind you later, go to install (install)
So you just install the dependencies and it's OK.
After cnpm install
runs successfully,
finally enter in the browser: http://localhost:8080
The last step is to place the project in the code cloud.
- You can now find that the local code and the online code are inconsistent. Right-click Git Base to open the command line and use git status to view
- How to upload it.
git add. //Add to the buffer
git commit -m'project init hahah'
git push //Push the file online
After success.