question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot read property outDir of undefined

See original GitHub issue

team, on running npx hardhat compile, I’m getting the error TypeError: Cannot read property 'outDir' of undefined

here are my dependencies: image

here is my hardhat.config.ts: image

here is my tsconfig.json: image

on running npx hardhat compile image

env: ubuntu lts, node lts, and latest npm

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
itinancecommented, Sep 28, 2021

For me this error happened after upgrading hardhat and typechain to most recent versions.

This is the diff of my rollback that solved the issue at the moment:

diff --git a/package.json b/package.json
index 37212a9..9d2ba6c 100644
--- a/package.json
+++ b/package.json
@@ -25,10 +25,10 @@
   "devDependencies": {
     "@nomiclabs/buidler": "^1.4.8",
     "@nomiclabs/hardhat-ethers": "^2.0.2",
-    "@nomiclabs/hardhat-etherscan": "2.1.6",
+    "@nomiclabs/hardhat-etherscan": "^2.1.1",
     "@nomiclabs/hardhat-waffle": "^2.0.1",
     "@typechain/ethers-v5": "^6.0.5",
-    "@typechain/hardhat": "2.3.0",
+    "@typechain/hardhat": "^1.0.1",
     "@types/chai": "^4.2.15",
     "@types/chai-as-promised": "^7.1.3",
     "@types/mocha": "^8.2.2",
@@ -38,15 +38,15 @@
     "chai-datetime": "^1.8.0",
     "ethereum-waffle": "^3.3.0",
     "ethers": "^5.0.31",
-    "hardhat": "2.6.4",
+    "hardhat": "^2.1.1",
     "hardhat-deploy": "^0.9.1",
     "hardhat-gas-reporter": "^1.0.4",
     "hardhat-typechain": "^0.3.5",
     "solidity-coverage": "^0.7.17",
     "ts-generator": "^0.1.1",
     "ts-node": "^9.1.1",
-    "typechain": "5.1.2",
-    "typescript": "4.4.3"
+    "typechain": "^4.0.3",
+    "typescript": "^4.2.4"
   },

1reaction
sveitsercommented, Nov 17, 2021

And I sometimes need to rm -r node_modules and pnpm i 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot read property outDir of undefined · Issue #401 - GitHub
Comments · team, on running npx hardhat compile, I'm getting the error TypeError: Cannot read property 'outDir' of undefined · here are my ......
Read more >
javascript - TypeError: Cannot read properties of undefined ...
TypeError: Cannot read properties of undefined (reading 'getContractFactory') when testing contract · The error means that hre. · It seemed to ...
Read more >
TSConfig Reference - Docs on every TSConfig option
Setting the value to undefined will allow most JavaScript runtime checks for ... When set to true, TypeScript will raise an error when...
Read more >
API - esbuild
To join a set of files together with esbuild, import them all into a single ... This is because most code doesn't rely...
Read more >
@typechain/hardhat - npm
This is an example of how to set it: module.exports = { typechain: { outDir: 'src/types', target: 'ethers-v5', alwaysGenerateOverloads: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found