查看vue版本: npm list vue
查看vue-cli版本: vue -V
S1:node版本 @v14.15.1
S2:vue-cli @4.5.9
//全局安装vue-cli
yarn global add @vue/cli
//在vue项目中执行
vue upgrade --next
S3:vite新建项目
yarn create vite-app v3-learning
cd v3-learning
yarn
yarn dev
- 折磨我的vite, 报错如下:
warning package.json: No license field
$ vite
/bin/sh: vite: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
确定node、vue-cli、环境没错, 执行 yarn add vite
手动安装后
yarn dev
//✌️终于成功
Dev server running at:
> Local: http://localhost:3000/
> Network: http://192.168.1.187:3000/
安装成功看看源码
- 在vue3环境下新建文件夹
mkdir vue3-study
; - 初始化文件夹
git init
; - 初始化一个子模块, 放于source/vue-next下
git submodule add https://github.com/vuejs/vue-next source/vue-next
- 修改镜像
## 修改镜像 yarn config set registry https://registry.npm.taobao.org --global yarn config set disturl https://npm.taobao.org/dist --global
- 安装依赖
yarn --ignore-scripts
//去除pupteer、忽略下载Chromium - 打包
yarn dev
此处又开始报错...
既然找不到就安装一下yarn add rollup-plugin-typescript2 typescript --dev -W
, yarn dev后又报错...
...接着安装cnpm install @rollup/plugin-replace
(yarn不成,借助cnpm)
-
打包成功的样子:
- 此处
ctrl +c
中断, 已经生成dist文件