yarn create vite my-vue-app --template报错

报错方式:

 

 

yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-vite@4.0.0" with binaries:
      - create-vite
      - cva
The filename, directory name, or volume label syntax is incorrect.
error Command failed.
Exit code: 1
Command: D:\NodeJS\node_global\bin\create-vite
Arguments: my-vite-vue3-app1 --template vue
Directory: E:\Vue项目
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

错误原因:

yarn的安装包默认是在c盘的而我yarn安装在在D盘的所以就会报这样的错误!

使用命令查看位置

yarn global dir

可查看到:

 

 

解决办法:

1.将yarn的全局路径改到D盘就行了,在D盘创建yarn文件夹在文件下创建一个golbal和cache文件夹
2.执行下列命令:

yarn config set global-folder "D:\yarn\global"
yarn config set cache-folder "D:\yarn\cache"

 

 问题解决, 继续运行创建项目的代码:

 

 

 

 更多参考链接:  https://blog.csdn.net/qq_26018335/article/details/126201219

posted @ 2022-12-27 10:57  大熊丨rapper  阅读(913)  评论(0编辑  收藏  举报