For example I have package.json
{
"dependencies": {
"@dfinity/agent": "^0.21.4",
"@dfinity/principal": "^0.21.4"
}
}
And I want to install @dfinity/ledger-icp
npm i @dfinity/ledger-icp
but I get errors:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @dfinity/agent@0.21.4
npm ERR! node_modules/@dfinity/agent
npm ERR! @dfinity/agent@"^0.21.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @dfinity/agent@"^0.20.2" from @dfinity/ledger-icp@2.1.2
npm ERR! node_modules/@dfinity/ledger-icp
npm ERR! @dfinity/ledger-icp@"*" 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!
npm ERR! For a full report see:
npm ERR! /home/zen/.npm/_logs/2024-02-07T07_21_27_988Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: /home/zen/.npm/_logs/2024-02-07T07_21_27_988Z-debug-0.log
This happens because ^0.x.x
in npm works as ~0.x.x
. With ^1.x.x
this problem should disappear.
Also, it would be great to follow semantic versioning