2

I am running npm install, and I got this error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: my-project@0.1.0
npm ERR! Found: @cxx/jxx-xxxxx@0.0.9
npm ERR! node_modules/@cxx/jxx-xxxxx
npm ERR!   @cxx/jxx-xxxxx@"0.0.9" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @cxx/jxx-xxxxx@"^0.0.8" from @cxx/cxx-util@0.10.7
npm ERR! node_modules/@cxx/cxx-util
npm ERR!   @cxx/cxx-util@"^0.10.7" 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/cxx/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:

Does not "0.0.9" satisfy "^0.0.8"? It's confusing...

My npm version is v7.18.1 while node version is v16.4.0, on MacOS Big Sur 11.4.

Thanks.

John Chan
  • 21
  • 1
  • 1
    Command with --force, or --legacy-peer-deps works but I just want to know why there is a conflict between "0.0.9" and "^0.0.8". And will `npm install` command install peer dependencies automatically? If not, how could npm throw an error for peer dependence conflicting and exit the process? – John Chan Jul 06 '21 at 12:56

2 Answers2

0

Recently I was in a familiar problem.

Try to use node 14.x.x

A bunch of dependencies just run in node LTS (v14.17.3 today). With that being said, maybe this dependecy can't run in node v16.4.0.

I think this will fix.

danielsrod
  • 50
  • 1
  • 8
0

" Does not "0.0.9" satisfy "^0.0.8" "? No apparently, however 1.0.9 does satisfies ^1.0.8

NPM behaves differently when the MAJOR version is 0 e.g 0.0.2 Upgrade your packages to start with the major version 1 and then the peerDependencies should work correctly. I've looked for some reference on this info but failed to find even though I record reading about it somewhere on a issue on Github, however I can assure you from personal experience. I was having the same issue and once I've bumped the major version to 1 everything worked as expected.

  • Personal experience is not that reliable most of the time. It would be good if you find the documentation/GitHub issue/any other valid source of information. It's important to understand the problem and the solution, not just poke at it and find it by chance. – doublethink13 Dec 09 '22 at 11:19