Remove the existing file and try again, or run npm (安裝vue3出錯)


 

1、報錯情況

Remove the existing file and try again, or run npm

C:\Users\zfwxzx\AppData\Roaming\npm-cache\_logs\2021-07-20T07_31_15_801Z-deb

 

2、解決步驟

 

直接前往 C:\Users\Administrator\AppData\Roaming\npm\vue找到這個vue文件然后刪除,在重新全局安裝,就可以了(如果不確定,那就把vue的文件都刪除)

 

3、執行命令(依次執行)

npm install -g @vue/cli

 

vue upgrade --next

執行完  vue upgrade --next   會出現報錯

報錯提示:

D:\websocket>vue upgrade --next
 ERROR  Error: The package.json file at 'D:\websocket\package.json' does not exist
Error: The package.json file at 'D:\websocket\package.json' does not exist
    at getPackageJson (C:\Users\zfwxzx\AppData\Roaming\npm\node_modules\@vue\cli\lib\util\getPkg.js:14:11)
    at getPkg (C:\Users\zfwxzx\AppData\Roaming\npm\node_modules\@vue\cli\lib\util\getPkg.js:27:15)
    at new Upgrader (C:\Users\zfwxzx\AppData\Roaming\npm\node_modules\@vue\cli\lib\Upgrader.js:30:16)
    at upgrade (C:\Users\zfwxzx\AppData\Roaming\npm\node_modules\@vue\cli\lib\upgrade.js:12:20)

 

解決方式:

執行    npm init -y  創建一個空的package.json

4、再次執行

vue upgrade --next

   會提示: DONE  Seems all plugins are up to date. Good work!

 

5、執行vue文檔中的安裝步驟即可安裝成功

npm init @vitejs/app

√ Project name: ... vite-project
√ Select a framework: » vue    //  選擇vue  一路回車
√ Select a variant: » vue

 

進入 cd vite-project

執行 npm install

執行  npn run dev  即可運行

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM