【问题标题】:laravel 9 : could not resolve peerDependencies during install reactJs & VueJs using laravel/uilaravel 9:在使用 laravel/ui 安装 reactJs 和 VueJs 期间无法解析 peerDependencies
【发布时间】:2023-01-10 19:06:32
【问题描述】:

我在 Fresh Laravel 9 中安装了Laravel/Ui 进行设置ReactJs

我在 cli 中一步一步地按照命令运行

composer require laravel/ui  

php artisan ui react

npm install

现在,当我运行npm install 命令时,它会抛出关于“无法解析依赖树”的错误,如下所示

microtech-007@microtech-007:/var/www/html/laravel-cms$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: vite@4.0.4
npm ERR! node_modules/vite
npm ERR!   dev vite@"^4.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^3.0.0" from @vitejs/plugin-react@2.2.0
npm ERR! node_modules/@vitejs/plugin-react
npm ERR!   dev @vitejs/plugin-react@"^2.2.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.
npm ERR! 
npm ERR! See /home/microtech-007/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/microtech-007/.npm/_logs/2023-01-10T09_34_09_381Z-debug-0.log

附加:- 如果您尝试设置浏览器使用拉维/用户界面然后在运行npm install命令时可能会出现如下错误

microtech-007@microtech-007:/var/www/html/laravel-cms$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: vite@4.0.4
npm ERR! node_modules/vite
npm ERR!   dev vite@"^4.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer vite@"^3.0.0" from @vitejs/plugin-vue@3.2.0
npm ERR! node_modules/@vitejs/plugin-vue
npm ERR!   dev @vitejs/plugin-vue@"^3.0.1" 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.
npm ERR! 
npm ERR! See /home/microtech-007/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/microtech-007/.npm/_logs/2023-01-10T09_54_29_026Z-debug-0.log

【问题讨论】:

    标签: reactjs vue.js npm laravel-9 laravel-ui


    【解决方案1】:

    如果您在设置过程中遇到问题ReactJs / VueJs使用 laravel/用户界面

    然后按照下面的步骤

    对于 ReactJs

    步骤 1 删除“@vitejs/plugin-react”包。运行npm un @vitejs/plugin-react

    现在,尝试运行npm install 命令。它成功安装了所有软件包。

    然后再次安装“@vitejs/plugin-react”包作为开发依赖

    第 2 步:- npm i @vitejs/plugin-react --save-dev或者npm i -D @vitejs/plugin-react

    完成...现在您可以使用npm run devnpm run build


    对于 VueJs

    步骤 1 删除“@vitejs/plugin-vue”包。运行npm un @vitejs/plugin-vue

    现在,尝试运行npm install命令。它成功安装了所有软件包。

    然后再次安装“@vitejs/plugin-vue”包作为开发依赖

    第 2 步:- npm i @vitejs/plugin-vue --save-dev或者npm i -D @vitejs/plugin-vue

    完成...现在您可以使用npm run devnpm run build

    我希望这对某人有帮助

    参考资料:- [BUG] Could not resolve peerDependencies of matching semver ranges

    【讨论】:

    猜你喜欢
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 2022-01-04
    • 2022-08-21
    • 2022-12-23
    • 1970-01-01
    • 2016-08-10
    • 2020-11-13
    相关资源
    最近更新 更多