wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.17k stars 283 forks source link

Error: Package subpath './lib/utils' is not defined by "exports" #422

Closed waynehoover closed 1 year ago

waynehoover commented 1 year ago

Hello,

I'm getting this error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/utils' is not defined by "exports" in /Users/wayne/code/rabbithole.gg/quest-protocol/node_modules/ethers/package.json
    at throwExportsNotFound (internal/modules/esm/resolve.js:285:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:508:3)
    at resolveExports (internal/modules/cjs/loader.js:450:36)
    at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/wayne/code/rabbithole.gg/quest-protocol/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/Users/wayne/code/rabbithole.gg/quest-protocol/node_modules/@openzeppelin/hardhat-upgrades/src/utils/deploy.ts:4:1) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
error Command failed with exit code 1.

my package.json

{
  "name": "quest-protocol",
  "author": {
    "name": "rabbitholegg"
  },
  "description": "📦 A protocol that distributes a reward for on-chain action",
  "version": "1.0.0",
  "homepage": "https://rabbithole.gg",
  "keywords": [
    "rabbitholegg",
    "quest",
    "erc20"
  ],
  "scripts": {
    "postinstall": "typechain",
    "precompile": "rimraf ./build/",
    "compile": "yarn hardhat compile",
    "pretest": "yarn compile",
    "test": "yarn hardhat test",
    "clean": "yarn hardhat clean",
    "prepublishOnly": "yarn test",
    "prepare": "husky install",
    "test:coverage": "yarn hardhat coverage",
    "test:gas-stories": "yarn hardhat --config hardhat.gas-stories.config.ts test"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/rabbitholegg/quest-protocol/"
  },
  "files": [
    "build"
  ],
  "engines": {
    "node": ">=10"
  },
  "lint-staged": {
    "*.{js,ts,sol}": "prettier --write"
  },
  "devDependencies": {
    "@ethersproject/abi": "^5.7.0",
    "@ethersproject/providers": "^5.7.2",
    "@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
    "@nomicfoundation/hardhat-toolbox": "^2.0.1",
    "@nomiclabs/hardhat-etherscan": "^3.1.6",
    "@openzeppelin/contracts": "4.8.0",
    "@openzeppelin/contracts-upgradeable": "4.8.0",
    "@openzeppelin/hardhat-defender": "^1.8.2",
    "@openzeppelin/hardhat-upgrades": "^1.22.1",
    "@typechain/ethers-v5": "^10.2.0",
    "@typechain/hardhat": "^6.1.5",
    "@types/chai": "^4.3.4",
    "@types/mocha": "^10.0.1",
    "axios": "^1.3.3",
    "chai": "^4.3.7",
    "commander": "^10.0.0",
    "ethereumjs-util": "^7.1.5",
    "hardhat-gas-reporter": "^1.0.9",
    "husky": ">=8.0.3",
    "lint-staged": ">=13.1.2",
    "mocha": "^10.2.0",
    "prettier": "^2.8.4",
    "prettier-plugin-solidity": "^1.1.2",
    "rimraf": "^4.1.2",
    "solc": "0.8.18",
    "solidity-coverage": "^0.8.2",
    "ts-node": "^10.9.1",
    "typechain": "^8.1.1",
    "typescript": ">=4.9.5",
    "@nomicfoundation/hardhat-network-helpers": "^1.0.8",
    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@0.3.0-beta.12",
    "@nomiclabs/hardhat-waffle": "^2.0.5",
    "dotenv": "^16.0.3",
    "ethers": "^6.0.3",
    "hardhat": "^2.12.7",
    "hardhat-preprocessor": "^0.1.5"
  }
}

On a fresh install, any idea why?

waynehoover commented 1 year ago

It looks like @openzeppelin/hardhat-upgrades doesn't like the imports with ethers.

waynehoover commented 1 year ago

This looks to be an issue in the OZ upgrades plugin, I created an issue there: https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/747