小编Moe*_*jac的帖子

无法读取未定义的属性(读取“parseUnits”) - Hardhat js

当尝试在测试函数中使用时,ethers.utils.parseUnits("1", "ether")会引发错误TypeError: Cannot read properties of undefined (reading 'parseUnits')

const { deployments, ethers, getNamedAccounts } = require("hardhat")
const { assert, expect } = require("chai")
describe("FundMe", async function () {
    let fundMe
    let deployer
    const sendValue = ethers.utils.parseUnits("1", "ether")
})
Run Code Online (Sandbox Code Playgroud)

我也尝试过使用 parseEther 得到相同的结果。在ethers.utils.parseUnits 的文档规范中,它说只使用它。我还缺少其他功能吗?我的以太配置可能不正确吗?

javascript chai solidity ethers.js hardhat

3
推荐指数
1
解决办法
1775
查看次数

标签 统计

chai ×1

ethers.js ×1

hardhat ×1

javascript ×1

solidity ×1