错误hh8:在您的配置文件中有一个或多个错误: *无效的值nesthatconfig.networks.rinkeby.url-期望t的值

发布于 2025-02-06 00:28:00 字数 736 浏览 2 评论 0原文

当我尝试在Rinkeby网络上运行脚本时,我会遇到此错误:

Error HH8: There's one or more errors in your config file:

Invalid value undefined for HardhatConfig.networks.rinkeby.url - Expected a value of type string.
     require('@nomiclabs/hardhat-waffle');
require('dotenv').config();

module.exports = {
  solidity: '0.8.1',
  networks: {
    rinkeby: {
      url: process.env.STAGING_ALCHEMY_KEY,
      accounts: process.env.PRIVATE_KEY,
    },
   
  },
};

.ENV文件

process.env.STAGING_ALCHEMY_KEY=https://eth-rinkeby.dotdotdot          
                                                                                 
process.env.PRIVATE_KEY=PRIVATE_KEY

,请有什么问题?

I get this error when i try to run my script on the rinkeby network:

Error HH8: There's one or more errors in your config file:

Invalid value undefined for HardhatConfig.networks.rinkeby.url - Expected a value of type string.
     require('@nomiclabs/hardhat-waffle');
require('dotenv').config();

module.exports = {
  solidity: '0.8.1',
  networks: {
    rinkeby: {
      url: process.env.STAGING_ALCHEMY_KEY,
      accounts: process.env.PRIVATE_KEY,
    },
   
  },
};

.env File

process.env.STAGING_ALCHEMY_KEY=https://eth-rinkeby.dotdotdot          
                                                                                 
process.env.PRIVATE_KEY=PRIVATE_KEY

Please what could possibly be the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

粉红×色少女 2025-02-13 00:28:05

检查您是否在根文件夹中,如果不在根文件夹中,请转到文件夹的根,然后重试

check are you in root folder or not, if not then go to root of folder and try again

暖树树初阳… 2025-02-13 00:28:05

在网络之后和URL之前添加Goerli。

module.exports = {
  solidity: "0.8.4",
  networks: {
    goerli:{
      url: process.env.STAGING_ALCHEMY_KEY,
      accounts: [process.env.PRIVATE_KEY],
    }
  },
};

Add goerli after networks and before url.

module.exports = {
  solidity: "0.8.4",
  networks: {
    goerli:{
      url: process.env.STAGING_ALCHEMY_KEY,
      accounts: [process.env.PRIVATE_KEY],
    }
  },
};
无人问我粥可暖 2025-02-13 00:28:04

确保.env和hardhat.config.js都位于hardhat-tutorial文件夹中

make sure both .env and hardhat.config.js are in the hardhat-tutorial folder

﹂绝世的画 2025-02-13 00:28:04

可能是这里的几件事,但是如果您使用create-react-app您的.env变量需要用react_app_app将变量前缀。因此,以示例为例,您的Env变量staging_alchemy_key应为react_app_staging_alchemy_key。如果您使用webpack,则可能需要在此处进行一些修改。希望这会有所帮助。

Could be a few things here but if you're using create-react-app your .env variables need to be prefixed with REACT_APP. So by example your env variable STAGING_ALCHEMY_KEY should be REACT_APP_STAGING_ALCHEMY_KEY. If you use webpack you might need to make some modifications in here as well. Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文