wighawag / hardhat-deploy-ethers

MIT License
70 stars 25 forks source link

Installation advice breaks @nomiclabs/hardhat-waffle #13

Closed banshee closed 1 year ago

banshee commented 3 years ago
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/hardhat-ethers@0.3.0-beta.10
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/hardhat-waffle@2.0.1
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 commented 3 years ago

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

my template repo works and the line is : "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@0.3.0-beta.10",

chrisdotn commented 3 years ago

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:hardhat-deploy-ethers@0.3.0-beta.10",
    "@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 commented 3 years ago

Same here

npm ERR! Found: @nomiclabs/hardhat-ethers@0.3.0-beta.10
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/hardhat-waffle@2.0.1
npm ERR! node_modules/@nomiclabs/hardhat-waffle
npm ERR!   dev @nomiclabs/hardhat-waffle@"*" from the root project

@nomiclabs/hardhat-waffle@2.0.1 expects @nomiclabs/hardhat-ethers to be ^2.0.0 but it's "only" 0.3.0-beta.10.

wighawag commented 3 years ago

Thanks for your reports. The best way forward will be to fix the following issue in hardhat: https://github.com/nomiclabs/hardhat/issues/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 commented 2 years ago

Any progress on this issue or workaround maybe?

chntr commented 2 years ago

Having same issue, any progress?

OCWC22 commented 2 years ago

Encountered the same issue as of now. No update?

wighawag commented 2 years ago

@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 commented 2 years ago

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/hardhat-waffle@2.0.1" has incorrect peer dependency "@nomiclabs/hardhat-ethers@^2.0.0".
warning " > @nomiclabs/hardhat-waffle@2.0.1" has unmet peer dependency "ethereum-waffle@^3.2.0".
warning " > hardhat-deploy@0.9.24" has unmet peer dependency "@ethersproject/hardware-wallets@^5.0.14".
outdoteth commented 2 years ago

Can confirm, getting the same error

node version: v16.13.2 npm version: 8.1.2

wighawag commented 2 years ago

@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 : https://github.com/wighawag/hardhat-deploy-ethers/issues/13#issuecomment-877578055

outdoteth commented 2 years ago

@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:hardhat-deploy-ethers@0.3.0-beta.10",
    "@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 commented 2 years ago

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 commented 2 years ago

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

outdoteth commented 2 years ago

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

wighawag commented 2 years ago

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 commented 2 years ago

By the way, the best way froward out of this issue is to have this issue resolved : https://github.com/nomiclabs/hardhat/issues/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 commented 2 years ago

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 commented 2 years ago

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/hardhat-waffle@2.0.3
npm ERR! Found: @nomiclabs/hardhat-ethers@0.3.0-beta.13
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/hardhat-waffle@2.0.3
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/hardhat-ethers@2.0.6
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/hardhat-waffle@2.0.3
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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

Jdemig commented 1 year ago

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 commented 1 year ago

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 hardhat@2.13.0-dev.2 See Pull Request 3498

wighawag commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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/account-contracts@2.0.0
npm ERR! Found: @nomiclabs/hardhat-ethers@0.3.0-beta.13
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/hardhat-chai-matchers@1.0.6
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/hardhat-waffle@2.0.3
npm ERR! Found: @nomiclabs/hardhat-ethers@0.3.0-beta.13
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/hardhat-waffle@2.0.3
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/hardhat-ethers@2.2.3
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/hardhat-waffle@2.0.3
npm ERR!   node_modules/@nomiclabs/hardhat-waffle
npm ERR!     dev @nomiclabs/hardhat-waffle@"^2.0.3" from the root project
jLiucoder commented 1 year ago

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/account-contracts@2.0.0
npm ERR! Found: @nomiclabs/hardhat-ethers@0.3.0-beta.13
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/hardhat-chai-matchers@1.0.6
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/hardhat-waffle@2.0.3
npm ERR! Found: @nomiclabs/hardhat-ethers@0.3.0-beta.13
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/hardhat-waffle@2.0.3
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/hardhat-ethers@2.2.3
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomiclabs/hardhat-waffle@2.0.3
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