1. 程式人生 > 其它 >yarn create vite my-vue-app --template vue建立專案報錯

yarn create vite my-vue-app --template vue建立專案報錯

根據官方文件的步驟建立專案,報錯如下:

success Installed "[email protected]" with binaries:
- create-vite
- cva
error An unexpected error occurred: "EPERM: operation not permitted, unlink 'C:\\Program Files\\nodejs\\node_global\\bin\\create-next-app'".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\86181\\AppData\\Local\\Yarn\\Data\\global\\yarn-error.log".


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

報錯的末尾給了一個網址:https://yarnpkg.com/en/docs/cli/create

開啟看了下

翻譯一下大意就是,這句命令其實是做了兩件事,全域性安裝了create-vite 用create vite建立專案

大家可以去nodejs下去看下有沒有安裝上create-vite

這裡的命令可以看到是create-vite已經安裝上了.但是為什麼建立專案會失敗呢.這裡我也沒想明白,難道是用create vite建立專案的?

因為我試了下用create vite my-vue3 --template vue建立專案,結果報錯找不到命令

然後換成create-vite my-vue-app --template vue建立就成功了

記錄一下,有遇到相同問題的可以看下是否安裝了全域性命令,然後直接用命令建立專案試試