hardhat-ethernal icon indicating copy to clipboard operation
hardhat-ethernal copied to clipboard

0.8.1 install error: Could not resolve dependency @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.10"

Open deanpress opened this issue 2 years ago • 13 comments

Console log:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hardhat-project@undefined
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"^2.0.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.10" from [email protected]
npm ERR! node_modules/hardhat-ethernal
npm ERR!   dev hardhat-ethernal@"^0.8.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.

package.json:

{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.5",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "chai": "^4.3.6",
    "dotenv": "^16.0.0",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.4",
    "hardhat": "^2.9.0",
    "hardhat-contract-sizer": "^2.5.0",
    "hardhat-gas-reporter": "^1.0.8",
    "hardhat-ethernal": "^0.8.1"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^4.5.0"
  }
}

deanpress avatar May 07 '22 15:05 deanpress

Are you using npm or yarn?

If npm, can you run npm install --force?

antoinedc avatar May 07 '22 15:05 antoinedc

We have the same problem and I wanted to ask you why are using a "beta" as dependecy for Ethernal instead of the stable 2.0.5

Jhoscy avatar May 07 '22 15:05 Jhoscy

Because of how Hardhat plugins work, Ethernal has to use the ethers version that is included in hardhat-deploy-ethers. The "beta" version is the version of hardhat-deploy-ethers, which uses and exports ethers v2.0.5.

antoinedc avatar May 07 '22 15:05 antoinedc

Console log:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hardhat-project@undefined
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"^2.0.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.10" from [email protected]
npm ERR! node_modules/hardhat-ethernal
npm ERR!   dev hardhat-ethernal@"^0.8.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.

package.json:

{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.5",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "chai": "^4.3.6",
    "dotenv": "^16.0.0",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.4",
    "hardhat": "^2.9.0",
    "hardhat-contract-sizer": "^2.5.0",
    "hardhat-gas-reporter": "^1.0.8",
    "hardhat-ethernal": "^0.8.1"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^4.5.0"
  }
}

I faced the same error and I fixed installing: "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13". If you are working using Linux (like me), you can get another error (not on MacOS) about keytar. In that case you need to run: sudo apt-get install libsecret-1-dev. Then, if you run npm i (with hardhat-ethernal 0.8.1), it works.

Jhoscy avatar May 07 '22 16:05 Jhoscy

On hardhat-ethernal 0.8.1 we are speaking with Antoine about changing in: hardhat-ethernal/dist/type-extensions.d.ts from

declare module "hardhat/types/config" {
    interface HardhatConfig {
        disableEthernal?: boolean;
    }
}

to

declare module "hardhat/types/config" {
    interface HardhatUserConfig {
        disableEthernal?: boolean;
    }
}

in order to not get static error in hardhat.config.js about disableEthernal

Jhoscy avatar May 07 '22 16:05 Jhoscy

Console log:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hardhat-project@undefined
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   dev @nomiclabs/hardhat-ethers@"^2.0.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.10" from [email protected]
npm ERR! node_modules/hardhat-ethernal
npm ERR!   dev hardhat-ethernal@"^0.8.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.

package.json:

{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.5",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "chai": "^4.3.6",
    "dotenv": "^16.0.0",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.4",
    "hardhat": "^2.9.0",
    "hardhat-contract-sizer": "^2.5.0",
    "hardhat-gas-reporter": "^1.0.8",
    "hardhat-ethernal": "^0.8.1"
  },
  "dependencies": {
    "@openzeppelin/contracts": "^4.5.0"
  }
}

I faced the same error and I fixed installing: "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13". If you are working using Linux (like me), you can get another error (not on MacOS) about keytar. In that case you need to run: sudo apt-get install libsecret-1-dev. Then, if you run npm i (with hardhat-ethernal 0.8.1), it works.

Sorry I'm not sure what is the fix you are mentioning here. Do you mind explaining?

At the moment, the only fix I'm aware of for the dependency issue is to either use yarn or the --force flag with npm.

antoinedc avatar May 09 '22 16:05 antoinedc

I am having the same issue.. and I use --force and --legacy-peer-deps. It works fine. But if I want to install other deps, I got these error: image

I need to uninstall hardhat-ethernal, install ohter deps, and try install hardhat-ethernal with --force or --legacy-peer-deps again...

zeroarst avatar Jun 28 '22 10:06 zeroarst

Hi,

I have the same issue with 2.2.0 version of hardhat-ethers and 2.1.0 of hardhat-ethernals. Is there any solution for this, or it's necessary to use it together with --force flag only?

{
  "dependencies": {
    "@nomicfoundation/hardhat-toolbox": "^2.0.0",
    "@nomiclabs/hardhat-ethers": "^2.2.0",
    "@openzeppelin/contracts": "^4.7.3",
    "hardhat": "^2.12.0",
    "hardhat-ethernal": "^2.1.0"
  },
  "devDependencies": {
    "ts-node": "^10.9.1",
    "typescript": "^4.8.4"
  }
}

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @nomiclabs/[email protected]
npm ERR! node_modules/@nomiclabs/hardhat-ethers
npm ERR!   @nomiclabs/hardhat-ethers@"^2.2.0" from the root project
npm ERR!   peer @nomiclabs/hardhat-ethers@"^2.0.0" from @nomicfoundation/[email protected]
npm ERR!   node_modules/@nomicfoundation/hardhat-chai-matchers
npm ERR!     peer @nomicfoundation/hardhat-chai-matchers@"^1.0.0" from @nomicfoundation/[email protected]
npm ERR!     node_modules/@nomicfoundation/hardhat-toolbox
npm ERR!       @nomicfoundation/hardhat-toolbox@"^2.0.0" from the root project
npm ERR!   1 more (@nomicfoundation/hardhat-toolbox)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nomiclabs/hardhat-ethers@"npm:hardhat-deploy-ethers@^0.3.0-beta.10" from [email protected]
npm ERR! node_modules/hardhat-ethernal
npm ERR!   hardhat-ethernal@"^2.1.0" 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@"npm:hardhat-deploy-ethers@^0.3.0-beta.10" from [email protected]
npm ERR!   node_modules/hardhat-ethernal
npm ERR!     hardhat-ethernal@"^2.1.0" 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.

ludekvodicka avatar Oct 19 '22 09:10 ludekvodicka

Hi,

Yes, at the moment, you have to use the --force flag to install it unfortunately.

antoinedc avatar Oct 19 '22 10:10 antoinedc

thanks for the quick reply. Is there any eta for fixing this?

ludekvodicka avatar Oct 19 '22 10:10 ludekvodicka

Not yet, last time I checked, this issue was still coming from a conflict due to how Hardhat handles plugins.

My assumption was that using the --force flag shouldn't be an issue in general. Is there a reason for you to not use it?

antoinedc avatar Oct 19 '22 12:10 antoinedc

I think the issue is that hardhat already using beta.13 and your plugin beta.10. But maybe there is some other issue.

Regarding --force, the issue is that as soon as you use it once, you have to use it always, because it's not possible to call any other next "npm i " command without --force anymore.

ludekvodicka avatar Oct 19 '22 17:10 ludekvodicka

I'll take a look at those versions.

I see. And have you tried using yarn instead of npm? I think it works without the force flag

antoinedc avatar Oct 21 '22 07:10 antoinedc