使用hardhat安装依赖项时无法获取“Typechain”文件夹

问题描述 投票:0回答:2

当我安装所有依赖项但没有在打字稿安全帽中获得“typechain”文件夹时。如何获得?

npm 初始化

npm install --save-dev Hardhat

npx 硬达

选择高级示例项目....

npm install --save-dev“hardhat@^2.8.2”“@nomiclabs/hardhat-waffle@^2.0.0”“ethereum-waffle@^3.0.0”“chai@^4.2.0”“ethers@ ^5.0.0" "solhint@^3.3.6" "solidity-coverage@^0.7.16" "@typechain/ethers-v5@^7.0.1" "@typechain/hardhat@^2.3.0" "@typescript -eslint/eslint-plugin@^4.29.1" "@typescript-eslint/parser@^4

javascript typescript dependencies solidity hardhat
2个回答
2
投票

使用solidity安全帽时运行

npx hardhat compile
生成typechain文件夹

https://www.npmjs.com/package/@typechain/hardhat/v/3.1.0

的“任务”部分所示

2
投票

删除 typechain 文件夹后我遇到了类似的问题

运行前请务必运行以下命令

npx hardhat compile

npx hardhat clean
或者就我而言
yarn hardhat clean

来自文档

警告:第一次运行之前需要做

hardhat clean
,否则TypeChain会认为不需要生成任何类型。

https://github.com/dethcrypto/TypeChain/tree/master/packages/hardhat

© www.soinside.com 2019 - 2024. All rights reserved.