블록체인/Ethers & web3
Module '"hardhat"' has no exported member 'ethers' 에러 해결법
체인의정석
2023. 7. 21. 10:13
728x90
1. tsConfig 살펴보기
tsConfig에서 scripts 경로가 지정되어있는지 확인한다.
include 안에 들어가있는지 보면된다.
{
"compilerOptions": {
"target": "ES2017",
"module": "commonjs",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist",
"strict": true,
"rootDirs": ["./src", "./scripts", "./test"],
"esModuleInterop": true
},
"exclude": ["dist", "node_modules"],
"include": ["./test", "./src", "./scripts"],
"files": ["./hardhat.config.ts"]
}
2. hardhat.config.ts 살펴보기
import '@nomiclabs/hardhat-ethers'
hardhat-ethers가 잇는지 확인한다.
3. npm 설치 다시해보기
npm install --save-dev @nomiclabs/hardhat-ethers 'ethers@^5.0.0'
4. nodemodules 삭제 후 공식 문서 보고 처음부터 다시해보기
https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-ethers
Hardhat | Ethereum development environment for professionals by Nomic Foundation
Hardhat is an Ethereum development environment. Compile your contracts and run them on a development network. Get Solidity stack traces, console.log and more.
hardhat.org
npm install --save-dev @nomiclabs/hardhat-ethers 'ethers@^5.0.0'
728x90
반응형