今天下载安装vue-cli脚手架的时候,出现如下问题,刚开始我还以为是我曾经下载过vue-cli,然后我便去执行卸载的命令,事实证明我从未下载过vue-cli脚手架。
下面我就记录一下我自己的解决方法。
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated subscriptions-transport-ws@0.11.0: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm ERR! code EEXIST
npm ERR! path C:\Users\86159\AppData\Roaming\npm\vue.cmd
npm ERR! EEXIST: file already exists
npm ERR! File exists: C:\Users\86159\AppData\Roaming\npm\vue.cmd
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\86159\AppData\Local\npm-cache\_logs\2022-09-02T01_32_22_939Z-debug-0.log
1.清理缓存
以管理员的身份打开命令行窗口,输入
npm cache clean --force
强制清理缓存。
2.设置淘宝镜像
设置淘宝镜像源,不仅可以使得下载模块的速度加快,也可以解决很多莫名的bug.
npm config set registry https://registry.npm.taobao.org
3.安装vue-cli脚手架
直接在打开的命令行窗口中输入即可
npm install -g @vue/cli
-g表示全局安装。
出现下面的情况即表示安装成功,便可以使用vue create 项目名来创建vue项目了。