How to build a VUE project

1.Download node.js in your computer

  • The download address of Node.js :https://nodejs.org/zh-cn/download/
    image
  • Then run the .exe file and click the next button.
  • Input "path" in your terminal and check if you configure the Node.js
    image
  • If you are in China ,you can set the mirror of address to improve your download speed.
npm config set registry https://registry.npm.taobao.org 

2.Your can download nvm to manage your nodejs

Nvm is used to manage the nodejs in different version.We can change the different nodejs more easily.

3.Install webpack

npm install webpack -g

  • Input "webpack -v" in your terminal and check if you configure the webpack.
    image

4.Install vue&vue-cli

  • download vue.js
npm install vue -g
//-g indicate it's the global install.
  • download vue-cli
npm install @vue/cli –g  
//You can decide to install a specific version Cli: npm install -g @vue/cli@3.12.1 

5. Run your project

npm install  //download the dependences that we need in the project

image

npm run serve/dev

image
image
image

6.gyp ERR! find Python solution

gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
npm config set python "D:\Python27\python.exe"
npm config set node_gyp "D:\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"

7.create a vue module

we can create a vue module by using command vue create <modelename>

新建一个vue项目时,可能会出现下面的问题:
Vue创建项目出现连续的Parsing error:unexpected token.
将node和npm卸载后重装解决,我自己感觉是之前配置过vue2环境的电脑会出现这个问题

8.当我们创建好一个Vue项目后,它的目录结构如图:

image

posted @ 2023-08-02 22:44  PostMan_Zc  阅读(43)  评论(0)    收藏  举报