Я установил Laravel/Ui в Fresh Laravel 9 для настройки 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
Дополнительно: - если вы пытались настроить VueJs с помощью laravel/ui, вы можете получить ошибку, как показано ниже, во время выполнения команды 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/VueJs с помощью laravel/ui
Затем выполните следующий шаг
Для ReactJs
Шаг 1 Удалите пакет «@vitejs/plugin-react». Беги npm un @vitejs/plugin-react
Теперь попробуйте запустить команду npm install. он успешно устанавливает все пакеты.
Затем после установки пакета «@vitejs/plugin-react» снова как DevDependecies
Шаг 2: - npm i @vitejs/plugin-react --save-dev ИЛИ npm i -D @vitejs/plugin-react
Готово... Теперь вы можете использовать npm run dev ИЛИ npm run build
Для VueJ
Шаг 1 Удалите пакет «@vitejs/plugin-vue». Беги npm un @vitejs/plugin-vue
Теперь попробуйте запустить команду npm install. он успешно устанавливает все пакеты.
Затем после установки пакета «@vitejs/plugin-vue» снова как DevDependecies
Шаг 2: - npm i @vitejs/plugin-vue --save-dev ИЛИ npm i -D @vitejs/plugin-vue
Готово... Теперь вы можете использовать npm run dev ИЛИ npm run build
Я надеюсь, что это поможет кому-то
Ссылки: - [ОШИБКА] Не удалось разрешить одноранговые зависимости соответствующих диапазонов semver
Для других ссылок на ошибки, связанных с Npm, см. здесь, может это поможет вам stackoverflow.com/a/34719468/14344959