确保nodejs.cn已经安装好
判断是否安装好
node -v(检查版本号)
npm -v (检查是否安装npm)
npm淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org(如果没有安装淘宝镜像,后面的命令把cnpm换成npm)
创建vue项目
1、cnpm install -g @vue/cli
2、vue create my-project
按键盘上下键选择默认(default)还是手动(Manually),如果选择default,一路回车执行下去就行了(注:现在vue-cli3.0默认使用yarn下载),这里我选择手动
Vue CLI v4.5.4
? Please pick a preset:
Default ([Vue 2] babel, eslint)
Default (Vue 3 Preview) ([Vue 3] babel, eslint)
> Manually select features
根据需求选择, 按键盘上下键移动,按space键确认选择
Vue CLI v4.5.4
? Please pick a preset: Manually select features
? Check the features needed for your project:
(*) Choose Vue version
(*) Babel
( ) TypeScript
( ) Progressive Web App (PWA) Support
(*) Router
(*) Vuex
>(*) CSS Pre-processors
(*) Linter / Formatter
( ) Unit Testing
( ) E2E Testing
选择您想要开始项目的Vue.js版本
Vue CLI v4.5.4
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, CSS Pre-processors, Linter
? Choose a version of Vue.js that you want to start the project with
2.x
> 3.x (Preview)
因为安装了router所以会弹出来,选择Y
Vue CLI v4.5.4
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, CSS Pre-processors, Linter