Laravel專案中無法安裝@vitejs/plugin-vue
P粉070918777
P粉070918777 2023-11-01 12:57:32

我創建了一個新的 Laravel 專案。為了使用 Vue JS,我嘗試安裝這個包,

@vitejs/plugin-vue

但這給我帶來了一系列錯誤,

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @vitejs/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vite
npm ERR!   dev vite@"^2.9.11" from the root project
npm ERR!   peer vite@"^2.9.9" from [email protected]
npm ERR!   node_modules/laravel-vite-plugin
npm ERR!     dev laravel-vite-plugin@"^0.4.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^3.0.0" from @vitejs/[email protected]
npm ERR! node_modules/@vitejs/plugin-vue
npm ERR!   @vitejs/plugin-vue@"^3.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/vite
npm ERR!   peer vite@"^3.0.0" from @vitejs/[email protected]
npm ERR!   node_modules/@vitejs/plugin-vue
npm ERR!     @vitejs/plugin-vue@"^3.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

我按照以下步驟操作,

1.laravel new {proj_name}.



2. npm install vue@next.



3. npm install.



4. After that I created a vue file and imported into app.js (resources/js/app.js).



5. I went to the blade file and cleared all -> hit `!` for emmet snippet, created a div with id #app, and add
    @vite('resources/js/app.js').

我拋出一個錯誤,說安裝@vitejs/plugin-vue。但是當我嘗試安裝它時,它會拋出這些錯誤。

P粉070918777
P粉070918777

全部回覆(2)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!