【问题标题】:I am getting this Error HH16: The directory C:\block\react-dapp contains files that could conflict: error when i run npx hardhat我收到此错误 HH16: The directory C:\block\react-dapp contains files that could conflict: error when I run npx hardhat
【发布时间】:2022-06-20 18:42:04
【问题描述】:

如何解决此错误 HH16:目录 C:\block\react-dapp 包含可能冲突的文件: 我第一次使用 Hardhat,当我在项目目录中运行 npx hardhat 时发生了这个错误。我在这里做了一些搜索,但没有一个帖子和答案能解决问题,任何帮助都将不胜感激

这是我的 package.json 文件

{
  "name": "react-dapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.5",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "@testing-library/jest-dom": "^5.16.2",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "chai": "^4.3.6",
    "ethereum-waffle": "^4.0.0-alpha.0",
    "ethers": "^5.6.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "hardhat": "^2.9.1"
  }
}

【问题讨论】:

  • 我也遇到了这个错误。发生冲突是因为hardhat 也在尝试创建一个名为REAMDE.md 的文件,但已经存在同名文件。我使用的一个简单技巧是将旧的重命名为 README.md.old 并再次运行 npx hardhat
  • 感谢 @nishant 它对我有用我更改了 REAMDE.md 并再次运行 npx 安全帽,它可以工作

标签: reactjs ethereum hardhat


【解决方案1】:

https://hardhat.org/errors/

HH16:项目创建期间文件冲突 您正在尝试创建一个新的安全帽项目,但存在将被创建过程覆盖的现有文件。

要么尝试使用新的目录名称,要么删除冲突的文件。

(Y)

【讨论】:

    【解决方案2】:

    因为 Hardhat 创建了另一个自述文件,所以删除你的自述文件并执行

    npx hardhat
    

    再次。它会正常工作。

    【讨论】:

      猜你喜欢
      • 2022-11-20
      • 2022-11-30
      • 2022-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-29
      • 2022-12-10
      • 1970-01-01
      相关资源
      最近更新 更多