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

Installation advice breaks @nomiclabs/hardhat-waffle #13

Closed
banshee opened this issue Jul 8, 2021 · 29 comments
Closed

Installation advice breaks @nomiclabs/hardhat-waffle #13

banshee opened this issue Jul 8, 2021 · 29 comments

Comments

@banshee
Copy link

banshee commented Jul 8, 2021

james@gig /tmp/asdf $ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.10" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR!   dev @nomiclabs/hardhat-waffle@"^2.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 /home/james/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/james/.npm/_logs/2021-07-08T18_05_56_589Z-debug.log
james@gig /tmp/asdf $ cat package.json 
{
  "devDependencies": {
    "@nomiclabs/hardhat-waffle": "^2.0.1",
    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.10",
    "ethers": "^5.4.1"
  }
}
james@gig /tmp/asdf $ 
@wighawag
Copy link
Owner

could it be that npm do not support the ^ when using alias ?

my template repo works and the line is : "@nomiclabs/hardhat-ethers": "npm:[email protected]",

@chrisdotn
Copy link

I'm facing the same problem. I've tried to use your line like this in my package.json:

  "dependencies": {
    "@chainlink/contracts": "^0.2.1",
    "@openzeppelin/contracts": "^4.1.0",
    "dotenv": "^10.0.0",
    "hardhat": "^2.4.1"
  },
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "npm:[email protected]",
    "@nomiclabs/hardhat-waffle": "^2.0.1",
    "chai": "^4.3.4",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.4.1",
    "hardhat-deploy": "^0.8.11",
    "hardhat-gas-reporter": "^1.0.4"
  }

@thundo
Copy link

thundo commented Aug 13, 2021

Same here

npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.10" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR!   dev @nomiclabs/hardhat-waffle@"*" from the root project

@nomiclabs/[email protected] expects @nomiclabs/hardhat-ethers to be ^2.0.0 but it's "only" 0.3.0-beta.10.

@wighawag
Copy link
Owner

wighawag commented Aug 17, 2021

Thanks for your reports.
The best way forward will be to fix the following issue in hardhat: NomicFoundation/hardhat#1040

This is what is blocking me from making hardhat-deploy-ethers and extension to hardhat-ethers

feel free to add your comments there

@develo-pera
Copy link

Any progress on this issue or workaround maybe?

@chntr
Copy link

chntr commented Oct 19, 2021

Having same issue, any progress?

@OCWC22
Copy link

OCWC22 commented Jan 12, 2022

Encountered the same issue as of now. No update?

@wighawag
Copy link
Owner

@OCWC22 do you have a repo reproducing the issue ?

It is working fine for me in this simple test repo : https://github.com/bug-reproduction/test-hardhat-deploy-ethers

@jannikluhn
Copy link

It is working fine for me in this simple test repo : https://github.com/bug-reproduction/test-hardhat-deploy-ethers

Getting the same error in this repo with npm (version 8.3.0) if I delete the package-lock.json first (otherwise I guess it doesn't do any dependency resolution).

With yarn (version 1.22.11) it works, but I get the following warnings:

warning " > @nomiclabs/[email protected]" has incorrect peer dependency "@nomiclabs/hardhat-ethers@^2.0.0".
warning " > @nomiclabs/[email protected]" has unmet peer dependency "ethereum-waffle@^3.2.0".
warning " > [email protected]" has unmet peer dependency "@ethersproject/hardware-wallets@^5.0.14".

@outdoteth
Copy link

Can confirm, getting the same error

node version: v16.13.2
npm version: 8.1.2

@wighawag
Copy link
Owner

@jannikluhn @outdoteth if you remove the package-lock what is probably happening is that the ^ make it use something else.

Can you try with the specific version specified as mentioned here : #13 (comment)

@outdoteth
Copy link

outdoteth commented Jan 28, 2022

@wighawag I still get the same error

rm -rf package-lock.json
rm -rf node_modules
npm install

Here is my package.json

{
  "name": "backspread",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "npm:[email protected]",
    "@nomiclabs/hardhat-waffle": "^2.0.2",
    "chai": "^4.3.6",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.3",
    "hardhat": "^2.8.3",
    "hardhat-deploy": "^0.10.1"
  }
}

Screenshot 2022-01-28 at 19 53 47

@wighawag
Copy link
Owner

wighawag commented Jan 28, 2022

Re warning @jannikluhn

the @nomiclabs/hardhat-ethers@^2.0.0 is probably expected since we are using hardhat-deploy-ethers instead of hardhat-ethers
@ethersproject/hardware-wallets@^5.0.14 is expected as it is an optional peer dependencies

and I suppose the ethereum-waffle is unrelated to the issue here

@wighawag
Copy link
Owner

@outdoteth thanks for trying out, I ll see if I can reproduce and figure out what is going on

@outdoteth
Copy link

Ok thanks - fwiw it is working on one of my other machines. I am trying to see what is different between them

@wighawag
Copy link
Owner

I just tried and can reproduce, seems like npm do not likes the npm@ when peer dependencies are involved

Note that npm i --force works in that case though

@wighawag
Copy link
Owner

By the way, the best way froward out of this issue is to have this issue resolved : NomicFoundation/hardhat#1040

this would allow me to have hardhat-deploy-ethers be an extension to hardhat-ethers instead of having to install it as alias

@mnukka
Copy link

mnukka commented May 16, 2022

Hey

I commented out from hardhat.config.ts:

import "@nomiclabs/hardhat-waffle";

And to my tests added:

import {waffleChai} from '@ethereum-waffle/chai';
use(waffleChai);

And now I can finally use revertedWith assertions in my tests.

@0xCourtney
Copy link

This issue seems to come up intermittently for me. Currently it's breaking in our CI after working fine for a few months. I'm having no issues on my local machine.

Console Output

Run npm ci
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @nomiclabs/[email protected]
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.13" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR!   dev @nomiclabs/hardhat-waffle@"^2.0.2" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR!   node_modules/@nomiclabs/hardhat-waffle
npm ERR!     dev @nomiclabs/hardhat-waffle@"^2.0.2" 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 /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-06-10T22_28_43_327Z-debug-0.log

package.json

    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
    "@nomiclabs/hardhat-waffle": "^2.0.2",
    ...
    "hardhat": "^2.8.4",
    "hardhat-deploy": "^0.10.6",
    ...

@0xCourtney
Copy link

This seems to be resolved after I set the node version to 16.15.0, from 16.15.1. The changing of the versions may explain the intermittency of the issue for me.

@suicide
Copy link

suicide commented Jul 14, 2022

I ran in the same issue just now, after having no problem in the last couple of months (?)
But i ended up defining an override which seems to be the "proper" workaround for now:

  "devDependencies": {
...
    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
...
},
  "overrides": {
    "@nomiclabs/hardhat-waffle": {
      "@nomiclabs/hardhat-ethers": "$@nomiclabs/hardhat-ethers"
    }
  }

@sashaaldrick
Copy link

@suicide this override fixed it for me, for now... thanks

@Jdemig
Copy link

Jdemig commented Dec 7, 2022

I'm not sure exactly what the issue is, but changing "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13", to "@nomiclabs/hardhat-ethers": "^2.2.1", seems to resolve it.

@ivanpajon
Copy link

ivanpajon commented Feb 7, 2023

Thanks for your reports. The best way forward will be to fix the following issue in hardhat: NomicFoundation/hardhat#1040

This is what is blocking me from making hardhat-deploy-ethers and extension to hardhat-ethers

feel free to add your comments there

@wighawag
Looks like this now can be implemented through [email protected]
See Pull Request 3498

@wighawag
Copy link
Owner

hardhat-deploy-ethers@next has been released
Please, try it out.

It is now an extension to hardhat-ethers so you need both

But note that that new version do not support external artifact if you were using them

@ivanpajon
Copy link

I'm trying to use the @next version with 'npm install --save-dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers@next' but still having the same installation issues. How should we do now with these changes? Thanks

@wighawag
Copy link
Owner

@ivanpajon

You need to install both

npm install --save-dev @nomiclabs/hardhat-ethers hardhat-deploy-ethers@next

and include both of them in hardhat.config.js :

require('hardhat-deploy`)
....
require('@nomiclabs/hardhat-ethers`)
require('hardhat-deploy-ethers`)

@filmakarov
Copy link

Hey @wighawag

Added hardhat-deploy to my repo a few weeks ago, but now facing issues with installing or updating packages

Install

> npm install --save-dev @nomicfoundation/hardhat-chai-matchers
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: @biconomy/[email protected]
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.13" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomicfoundation/[email protected]
npm ERR! node_modules/@nomicfoundation/hardhat-chai-matchers
npm ERR!   dev @nomicfoundation/hardhat-chai-matchers@"*" 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.

Update

npm update ethereum-waffle

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @nomiclabs/[email protected]
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.13" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR!   dev @nomiclabs/hardhat-waffle@"^2.0.3" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR!   node_modules/@nomiclabs/hardhat-waffle
npm ERR!     dev @nomiclabs/hardhat-waffle@"^2.0.3" from the root project

@jLiucoder
Copy link

Hey @wighawag

Added hardhat-deploy to my repo a few weeks ago, but now facing issues with installing or updating packages

Install

> npm install --save-dev @nomicfoundation/hardhat-chai-matchers
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: @biconomy/[email protected]
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.13" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomicfoundation/[email protected]
npm ERR! node_modules/@nomicfoundation/hardhat-chai-matchers
npm ERR!   dev @nomicfoundation/hardhat-chai-matchers@"*" 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.

Update

npm update ethereum-waffle

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @nomiclabs/[email protected]
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.13" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR!   dev @nomiclabs/hardhat-waffle@"^2.0.3" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/[email protected]
npm ERR!   node_modules/@nomiclabs/hardhat-waffle
npm ERR!     dev @nomiclabs/hardhat-waffle@"^2.0.3" from the root project

hey I was running into the same thing, after i used @next it has no more issue anymore, change your hardhat-deploy-ethers version and it should be working

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