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