three-nebula icon indicating copy to clipboard operation
three-nebula copied to clipboard

npm version 7 returns the error "ERESOLVE unable to resolve dependency tree".

Open MasatoMakino opened this issue 3 years ago • 1 comments

Expected Behavior

Using npm version 7, three.js r129 and three-nebula can be installed successfully

Actual Behavior

npm version 7 returns error messages

npm i
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/three
npm ERR!   dev three@"^0.129.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer three@"^0.122.0" from [email protected]
npm ERR! node_modules/three-nebula
npm ERR!   dev three-nebula@"10.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 .npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     .npm/_logs/2021-06-15T04_57_42_110Z-debug.log

Minimum configuration for reproduction

  • Install npm version 7
  • Configure package.json as follows.

▼package.json

  "devDependencies": {
    "three": "^0.129.0",
    "three-nebula": "10.0.1",
  }

Cause of the problem

This problem was caused by a destructive change in npm version 7.

https://github.blog/2021-02-02-npm-7-is-now-generally-available/

Peer dependencies

Automatically installing peer dependencies is an exciting new feature introduced in npm 7. In previous versions of npm (4-6), peer dependencies conflicts presented a warning that versions were not compatible, but would still install dependencies without an error. npm 7 will block installations if an upstream dependency conflict is present that cannot be automatically resolved.

You have the option to retry with --force to bypass the conflict or --legacy-peer-deps command to ignore peer dependencies entirely (this behavior is similar to versions 4-6).

npm v7 strictly validates versions of Peerdependencies. npm v7 will follow node-semver

Caret Ranges are related to this issue. Caret range behaves differently depending on whether the major version is 0 or not. If the major version is 0, it behaves as a minor version as a major version. Therefore, npm v7 will treat three.js 0.122.0 and three.0.129.0 as incompatible software with different major versions.

Proposal

https://github.com/creativelifeform/three-nebula/blob/2528fe059a698d744703905347efcfcaacfa8116/package.json#L70-L72

Change here to

"three": ">=0.122.0 <1.0.0"

Specifications

Version: three-nebula v10.0.1 + three.js r129 Platform: macOS 11.4 npm : 7.17.0

MasatoMakino avatar Jun 15 '21 05:06 MasatoMakino

Right okay! Happy to accept a PR for this one @MasatoMakino if you have time!

rohan-deshpande avatar Jun 17 '21 03:06 rohan-deshpande

This Issue was resolved by PR #172. Additionally, as there has been no activity for an extended period, this Issue will be closed. If any related issues are discovered, please feel free to reopen this Issue.

MasatoMakino avatar Jan 27 '24 05:01 MasatoMakino