Skip to content

unable to install leva, got error on "unable to resolve dependency tree" #415

@hopezh

Description

@hopezh

I got the following error while installing leva:

╰─ npm i leva          
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^16.x || ^17.x || ^18.x" from @radix-ui/[email protected]
npm ERR!   node_modules/@radix-ui/react-icons
npm ERR!     @radix-ui/react-icons@"^1.0.3" from [email protected]
npm ERR!     node_modules/r3f-perf
npm ERR!       r3f-perf@"6.5" from the root project
npm ERR!   peer react@"^16.8.0 || ^17.0.0 || ^18.0.0" from @react-spring/[email protected]
npm ERR!   node_modules/@react-spring/animated
npm ERR!     @react-spring/animated@"~9.6.1" from @react-spring/[email protected]
npm ERR!     node_modules/@react-spring/core
npm ERR!       @react-spring/core@"~9.6.1" from @react-spring/[email protected]
npm ERR!       node_modules/@react-spring/three
npm ERR!         @react-spring/three@"^9.3.1" from @react-three/[email protected]
npm ERR!         node_modules/@react-three/drei
npm ERR!     @react-spring/animated@"~9.6.1" from @react-spring/[email protected]
npm ERR!     node_modules/@react-spring/three
npm ERR!       @react-spring/three@"^9.3.1" from @react-three/[email protected]
npm ERR!       node_modules/@react-three/drei
npm ERR!         peer @react-three/drei@"*" from [email protected]
npm ERR!         node_modules/r3f-perf
npm ERR!         1 more (the root project)
npm ERR!   18 more (@react-spring/core, @react-spring/shared, ...)
npm ERR! 

npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8 || ^17.0" from @radix-ui/[email protected]
npm ERR! node_modules/leva/node_modules/@radix-ui/react-portal
npm ERR!   @radix-ui/react-portal@"^0.1.3" from [email protected]
npm ERR!   node_modules/leva
npm ERR!     leva@"*" 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 /Users/minioat/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/minioat/.npm/_logs/2022-12-29T17_12_11_451Z-debug.log

I have the following npm packages installed for this local project:

├── @react-three/[email protected]
├── @react-three/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

I found the following suggestions from StackOverflow, and they worked. However, I still don't know what was causing the error. So, can anyone advise? Thanks.

npm install --save --legacy-peer-deps
npm config set legacy-peer-deps true
npm cache clean --force

Source: https://stackoverflow.com/a/71786513/2559693

After applying the suggestions above, my local npm packages are:

╰─ npm --version 
7.13.0

╰─ npm list     
├── @react-three/[email protected]
├── @react-three/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions