一、安装node
1.地址:以往的版本 | Node.js
点击下载地址
指令
使用 Win + R
输入cmd
回车打开:
1.检查node是否安装
node -v
出现对应版本号就算成功
2.检查node 是否安装成功
npm -v
出现对应版本号就算成功
3.下载安装淘宝镜像
npm install cnpm -g --registry=https://registry.npm.taobao.org
4.下载脚手架
安装 vue-cli 脚手架
npm install -g vue-cli
检测是否安装成功:
vue -V 或 vue-version
5.升级脚手架
1.卸载
npm uninstall vue-cli -g
2.安装
npm install -g @vue/cli
如果npm版本和node 版本不匹配 需要升级npm或者降级npm版本
cnpm -v 或者 npm -v
cnpm install npm@npm的版本号 -g
cnpm install npm@8.1.0 -g
最后检测 脚手架是否安装成功
vue -V
安装vue 的脚手架项目
1.首先
vue create 项目名(必须英文)
第二步
Vue CLI v5.0.8
? Please pick a preset: (Use arrow keys) 选择安装的配置版本
> Default ([Vue 3] babel, eslint) vue 3 + babel +变态的语法检查(es list)
Default ([Vue 2] babel, eslint) vue 2 + babel +变态的语法检查(es list)
Manually select features 自定义配置(选择这个)
第三步
Check the features needed for your project: (Press <space> to select, <a> to
toggle al1, <i> to invert selection, and <enter> to proceed )
选择vue项目的配置依赖
>(*) Babel
( ) TypeScript 安装ts依赖
( ) Progressive Wweb App (PWA) Support
( ) Router (vue路由) 4
( ) Vuex (vue状态管理) 5
( ) CSsS Pre-processors (css预处理器) 6
(*) Linter 1 Formatter (代码检查工具)
( ) Unit Testing (测试环境)
( ) E2E Testing (同上,测试版本不样)
按下123456789键选择
选择456
第四步
Choose a version of Vue.js that you want to start the project with (Use arrow keys) 选择要配置的vue版本
> 3.x 3.0
2.x 2.0(选择)
第五步
use history mode for router? (Requires proper server setup for index fallbackion) (Y/n) 是 否使用router的history(N)
第六步
Pick a C5s pre-processor (PostCss, Autoprefixer and CsS Modules are supported
by default): (use arrow keys) 选择css的预处理工具(选择一种)
>Sass/SC5S (with dart-sass)
Less
stylus
第七步
Where do you prefer placing config for Babe1, ESLint, etc.? 在什么地方 配置 eslint
> In dedicatrd config files 专门的配置文件(选择)
In package.json 公用的
第八步
Save this as a preset for future projects? 项目配置(Y/N)N