Vue project hot deployment-environment configuration (6-1)

Vue project hot deployment-environment configuration

  1. First open the official website of node.js https://nodejs.org/en/
  2. Click DOWNLOADSInsert picture description here
  3. LTS is a long-term maintenance version, and Current is the latest version. We generally choose LTS
    Insert picture description here
  4. Choose your own corresponding system to install it. Fool-like next installation.
  5. 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.
    Insert picture description here

Registration code cloud

  1. https://gitee.com/ is used to put our code, or to work better at work.

  2. Create the project.
    Insert picture description here

  3. To create a warehouse, the license is generally MIT.
    Insert picture description here

  4. The warehouse has been built.
    Insert picture description here

  5. 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.

  6. Open cmd, enter git --version
    Insert picture description here

  7. Enter the git warehouse to open the settings, and you must get through offline and online.
    Insert picture description here

  8. Click SSH public key, how to generate a public key is based on Linux. Windows is different.
    Insert picture description here
    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.
    Insert picture description here

  9. Generate a public key, ssh-keygen -t rsa -C "xxx", and press Enter.
    Insert picture description here

  10. Check the public key again. Type cat ~/.ssh/id_rsa.pub
    11.

  11. Copy the public key into your ssh settings. Wait a while
    Insert picture description here

  12. Back in the warehouse, now we are going to clone our online warehouse to our offline. Click ssh, copy.
    Insert picture description here

  13. 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.
    Insert picture description here

Install Vue

You can check here for better. https://cli.vuejs.org/

  1. Install vue-cli globally: Command-npm install --global vue-cli
  2. Note: If there is an error, it may be the previous version, the error is as follows.
    Insert picture description here
    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

  1. 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.
    Insert picture description here
    Insert picture description here
    The following is as follows:

  2. Install vie-router? Do you need to route Y

  3. Use EsLint to lint your code? Whether to check the fairness of the code Y

  4. Pick an ESLint preset code detection specification Standard

  5. Set up unit tests whether to perform unit tests no

  6. Setup e2e tests with Nightwatch? An end-to-end test no

  7. Should we run npm installfor you after the project has been created? (recommended) Whether to use NPM or Yarn tools for management. Yes, use NPM

  8. 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.
    Insert picture description here

  9. Go to the downloaded folder. cmd runs npm run dev to start.
    Insert picture description here
    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
Insert picture description here
runs successfully,
Insert picture description here
finally enter in the browser: http://localhost:8080
Insert picture description here

The last step is to place the project in the code cloud.

  1. 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
    Insert picture description here
  2. How to upload it.

git add. //Add to the buffer
git commit -m'project init hahah'
git push //Push the file online

After success.
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45647118/article/details/114054499