使用vite创建vue3.0项目时报错Could not install from “xxxxxxxxxxx“ as it does not contain a package.json file.

报错描述:使用vite创建vue3.0项目时报错Could not install from “xxxxxxxxxxx” as it does not contain a package.json file.

报错原因:node_cache路径存在空格

通过命令查看

// 运行指令
npm config get cache
// Program Files名称存在空格
C:\Program Files\nodejs\node_cache

解决方法一:

// 运行指令
npm config edit

弹出对应文件=>将带空格的路径改写为:C:\Program~1\nodejs\node_cache
在这里插入图片描述

解决办法二

// 运行指令
npm config set cache "C:\Program~1\nodejs\node_cache" --global

猜你喜欢

转载自blog.csdn.net/XUELINGMM/article/details/130645464
今日推荐