I have cloned a project from GitHub and trying to install dependencies using npm install
but it throws error :
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.0.0 || ^16.0.0-beta || ^16.0.0" from [email protected]
npm ERR! node_modules/react-tilt
npm ERR! react-tilt@"^0.1.4" 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 C:\Users\Gyan Prakash\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Gyan Prakash\AppData\Local\npm-cache\_logs\2023-03-06T18_09_10_160Z-debug-0.log
there is any method to resolve this error.
[email protected]
package has below peer dependencies
$ npm view [email protected] peerDependencies
{
react: '^15.0.0 || ^16.0.0-beta || ^16.0.0',
'react-dom': '^15.0.0 || ^16.0.0-beta || ^16.0.0'
}
But in your project, the installed react
version is ^18.2.0
which is incompatible with the version specified in peerDependency
.
Two safe solutions:
react
package to those compatible versions.npm i react@^16.14.0 react-dom@^16.14.0 -S
Then, install the react-tilt@^0.1.4
:
$ npm i react-tilt@^0.1.4 -S
up to date, audited 10 packages in 1s
The warning is gone. List the installed package:
$ npm ls --depth 0
peer-deps-issue@ /home/lindu/workspace/peer-deps-issue
├── [email protected]
├── [email protected]
└── [email protected]
react-tilt
package to the latest version(1.0.2 until 2023.7.4) which is compatible with React 18.x
.$ npm view [email protected] peerDependencies
{
'@types/react': '^18.0.29',
'@types/react-dom': '^18.0.11',
react: '^18.2.0',
'react-dom': '^18.2.0'
}
Install the latest version of the react-tilt
package.
$ npm i react-tilt -S
List the installed packages:
$ npm ls --depth 0
peer-deps-issue@ /home/lindu/workspace/peer-deps-issue
├── [email protected]
├── [email protected]
└── [email protected]