一、环境准备
1、安装node.js
下载地址:https://nodejs.org/en/
D:\vue3>node -v v16.17.0 D:\vue3>npm -v 8.15.0
npm会随着node.js一起安装,所以,只要是node.js正常安装,就代表npm已经安装。检测方式:cmd命令窗口输入 npm -v 回车,能正常显示npm版本。
二、安装vue脚手架:Vue CLI
下载地址:https://cli.vuejs.org/zh/
官方文档说明
npm install -g @vue/cli # 原生npm的下载速度太慢,各种报错。因此,使用淘宝镜像来安装
npm install -g @vue/cli --registry=https://registry.npm.taobao.org # OR yarn global add @vue/cli
安装完成
D:\vue3\st02>vue -V @vue/cli 5.0.8
创建项目
D:\vue3>vue create st02 ? Your connection to the default npm registry seems to be slow. Use https://registry.npmmirror.com for faster installation? Yes Vue CLI v5.0.8 ? Please pick a preset: Default ([Vue 3] babel, eslint) ...... $ cd st02 $ npm run serve D:\vue3>
运行项目
DONE Compiled successfully in 4373ms 15:24:51 App running at: - Local: http://localhost:8080/ - Network: http://192.168.85.134:8080/ Note that the development build is not optimized. To create a production build, run npm run build.
访问:http://localhost:8080/

