Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[safe-contracts conflict] npm fails to install dependencies #500

Closed
germartinez opened this issue Aug 3, 2023 · 3 comments
Closed

[safe-contracts conflict] npm fails to install dependencies #500

germartinez opened this issue Aug 3, 2023 · 3 comments

Comments

@germartinez
Copy link
Member

germartinez commented Aug 3, 2023

Description

safe-contracts v1.4.1 has a fixed dependency ethers v5.4.0. This makes impossible to install dependencies using npm as it conflicts with the SDK necessary dependency, at the time of writing ethers v5.7.2 and in few days ethers v6

Cloning the repo from Github and running:

npm i

returns the following error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @safe-global/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/ethers
npm ERR!   dev ethers@"5.7.2" from @safe-global/[email protected]
npm ERR!   packages/protocol-kit
npm ERR!     @safe-global/[email protected]
npm ERR!     node_modules/@safe-global/protocol-kit
npm ERR!       workspace packages/protocol-kit from the root project
npm ERR!       5 more (@safe-global/account-abstraction-kit-poc, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer ethers@"5.4.0" from @safe-global/[email protected]
npm ERR! node_modules/@safe-global/safe-contracts-v1.4.1
npm ERR!   dev @safe-global/safe-contracts-v1.4.1@"npm:@safe-global/[email protected]" from @safe-global/[email protected]
npm ERR!   packages/protocol-kit
npm ERR!     @safe-global/[email protected]
npm ERR!     node_modules/@safe-global/protocol-kit
npm ERR!       workspace packages/protocol-kit from the root project
npm ERR!       5 more (@safe-global/account-abstraction-kit-poc, ...)
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! /Users/<user>/.npm/_logs/2023-08-02T15_24_40_733Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/<user>/.npm/_logs/2023-08-02T15_24_40_733Z-debug-0.log

Solution

Remove npm import for safe-contracts v1.4.1 and manually add the contracts to the SDK repository, the same way contracts prior to v1.2.0 were added

@yagopv
Copy link
Member

yagopv commented Aug 30, 2023

This is due to NPM v7+ installing peerDependencies by default. This is not the case with previous versions NPM

[email protected] has a peer using ethers 5.4.0. This should be addressed there for avoiding workarounds. Anyway you can do this:

  1. npm install --legacy-peer-deps
  2. npm install --force

Or we can
3) Forcing resolution to 5.7.2 => @dasanra ?

@dasanra
Copy link
Collaborator

dasanra commented Aug 30, 2023

I was also checking this issue. Forcing resolution to v5.7.2 won't work. Also it's probably going to add issues when we migrate to ethers v6.

Original issue here may be adding safe-contracts with all versions as dependencies of the protocol-kit when we only need the contracts for type generation. This adds plenty of dependencies that are becoming outdated to the project and will create more problems specially trying to support more than one package manager.

@dasanra dasanra changed the title npm installation fails [safe-contracts conflict] npm fails to install dependencies Oct 24, 2023
@dasanra
Copy link
Collaborator

dasanra commented Jan 17, 2025

It's not happening with latest version protocol-kit@v5

@dasanra dasanra closed this as completed Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants