【问题标题】:"npx hardhat accounts" not available in Hardhat latest version 2.9.9\"npx hardhat accounts\" 在 Hardhat 最新版本 2.9.9 中不可用
【发布时间】:2022-08-16 19:42:42
【问题描述】:

我已经安装了最新版本的安全帽。它安装得很好。

在设置安全帽并安装所有必需的软件包后,当我运行时:

npx hardhat accounts

它给出了一个错误:

Error HH303: Unrecognized task accounts

似乎在最新版本的安全帽中删除了“帐户”任务。我现在的问题是获取安全帽生成的钱包帐户列表?

  • 无法重现您的问题 - 在安装 hardhat@2.9.9 并初始化基本项目后,accounts 任务在我这边正常工作。你能检查你的hardhat.config.js 是否包含以task(\"accounts\" 开头的行吗?

标签: ethereum hardhat


【解决方案1】:

我不确定,但我设法通过根据需要将 waffle 迁移到 Beth chai masters 并从配置 waffle 并添加 chai masters 来解决这个问题 之后无法获得帐户,否则“npx hardhat node”看起来像在启动节点时显示的帐户,如果它可以提供帮助!

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
【解决方案2】:

我在 2022-08-16 也遇到了同样的情况。

要获取可用帐户,我使用npx hardhat node 命令。

我执行的命令序列是:

$ npx hardhat --version
2.10.1

$ npx hardhat accounts
Error HH303: Unrecognized task accounts
For more info go to https://hardhat.org/HH303 or run Hardhat with --show-stack-traces

$ npx hardhat node
Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/

Accounts
========

WARNING: These accounts, and their private keys, are publicly known.
Any funds sent to them on Mainnet or any other live network WILL BE LOST.

Account #0: 0xf39Fd6e51a...ffFb92266 (10000 ETH)
Private Key: 0xac0974bec39a1...478cbed5efcae784d7bf4f2ff80

Account #1: 0x70997970C51812...b50e0d17dc79C8 (10000 ETH)
Private Key: 0x59c6995e998f97a5a...9dc9e86dae88c7a8412f4603b6b78690d
.
.
.

【讨论】:

    猜你喜欢
    • 2022-11-06
    • 2022-11-30
    • 1970-01-01
    • 2022-09-28
    • 2022-11-19
    • 2022-06-14
    • 1970-01-01
    • 2022-01-05
    • 2022-08-17
    相关资源
    最近更新 更多