一、安装npm
二、安装cnpm
'''
npm install -g cnpm --registry=https://registry.npm.taobao.org
'''
三、安装yarn
'''
npm install -g yarn
'''
四、安装vue-cli脚手架工具。
'''
cnpm install -g @vue/cli
'''
注意:如出现 Error: Cannot find module 'diagnostics_channel'错误。
原因:cnpm版本太高了,npm全局安装的cnpm是最新版的,所以卸载原来的cnpm再装一个指定版本即可
卸载cnpm:
npm uninstall -g cnpm
安装指定版本:7.1.0
npm install cnpm@7.1.0 -g
五、创建vue项目
'''
vue create 项目名称
'''
'''
选择第三个自定义,进入下面选项卡
Vue CLI v5.0.8
? Please pick a preset: Manually select features
? Check the features needed for your project: (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
(*) Babel
( ) TypeScript
( ) Progressive Web App (PWA) Support
>(*) Router
(*) Vuex
( ) CSS Pre-processors
( ) Linter / Formatter
( ) Unit Testing
( ) E2E Testing
然后选择2.x还是3.x
然后。。。
'''