1. View the vue version
npm list vue
2. Uninstall vue2.x
npm uninstall vue-cli -g
3. Install the new version of vue3
Before installing vue3, make sure that the version of Node.js is higher than the minimum required version (Vue CLI 3 requires nodeJs ≥ 8.9 (8.11.0+ is officially recommended), check the Node.js version:
node -v
If the Node.js version is lower than the minimum version, you need to install a higher version of Node.js first.
Then install the latest version of scaffolding:
npm install -g @vue/cli
4. After the scaffolding is installed, check the vue version again. If the version is displayed, it means success.
Attachment: vue3 downgrades to vue2.x
//卸载vue3
npm uninstall -g @vue/cli
//安装vue2.x
npm install -g vue-cli