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

Cannot find module '../types' in test #2

Closed
MuMiMaNz opened this issue Dec 8, 2020 · 2 comments
Closed

Cannot find module '../types' in test #2

MuMiMaNz opened this issue Dec 8, 2020 · 2 comments

Comments

@MuMiMaNz
Copy link

MuMiMaNz commented Dec 8, 2020

Hello Aave team,
I want to run a test and got this error

`Error: Cannot find module '../types'
Require stack:

  • /src/helpers/contracts-getters.ts
  • /src/helpers/contracts-helpers.ts
  • /src/tasks/misc/initialize-tokens.ts
  • /src/hardhat.config.ts
  • /src/node_modules/hardhat/internal/core/config/config-loading.js
  • /src/node_modules/hardhat/internal/cli/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object. (/src/helpers/contracts-getters.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module.m._compile (/src/node_modules/ts-node/src/index.ts:858:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions. [as .ts] (/src/node_modules/ts-node/src/index.ts:861:12)
    at Module.load (internal/modules/cjs/loader.js:928:32) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/src/helpers/contracts-getters.ts',
    '/src/helpers/contracts-helpers.ts',
    '/src/tasks/misc/initialize-tokens.ts',
    '/src/hardhat.config.ts',
    '/src/node_modules/hardhat/internal/core/config/config-loading.js',
    '/src/node_modules/hardhat/internal/cli/cli.js'
    ]
    }
    `

and I look at in helper folder, it's missing lots of things, maybe you forgot the "types" folder ?

@PabiGamito
Copy link
Contributor

You need to compile the contracts and have typechain run. Typechain will generate everything you need in the types folder.

Set the environment variable SKIP_LOAD to true (export SKIP_LOAD="true") then run npx hardhat compile.

@nkrsic
Copy link

nkrsic commented Apr 26, 2022

This is a really weird and silly bug in VSCode auto-complete, I just experienced it exactly. When you type the it() clauses for testing, autocomplete fights you to insert isTypedArray() from util/types, and it also adds the import. The import added by VSCode code-completion / syntax help is what is causing this. Check the top of your testing file.

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

4 participants