You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Uniswap克隆项目启动时Webpack 5模块缺失错误求助

Uniswap克隆项目启动模块缺失错误求助

错误页面

我有一个Uniswap克隆项目,启动时出现模块找不到的错误,恳请懂相关技术的人士帮忙解决!

已尝试的解决方法

  • npm audit --fix
  • npm install cipher-base
  • 添加webpack.config.js

错误代码

Compiled with problems:X

ERROR in ../../node_modules/cipher-base/index.js 2:16-43

Module not found: Error: Can't resolve 'stream' in 'C:\Users\Asus\Desktop\nzl swap 1.0\my-eth-app\node_modules\cipher-base'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
  - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
  - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
  resolve.fallback: { "stream": false }


ERROR in ../../node_modules/eth-lib/lib/bytes.js 7:193-227

Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Asus\Desktop\nzl swap 1.0\my-eth-app\node_modules\eth-lib\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
  - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
  - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
  resolve.fallback: { "crypto": false }


ERROR in ../../node_modules/web3-eth-accounts/lib/index.js 27:74-91

Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Asus\Desktop\nzl swap 1.0\my-eth-app\node_modules\web3-eth-accounts\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
  - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
  - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
  resolve.fallback: { "crypto": false }


ERROR in ../../node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 5:193-227

Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Asus\Desktop\nzl swap 1.0\my-eth-app\node_modules\web3-eth-accounts\node_modules\eth-lib\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
  - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
  - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
  resolve.fallback: { "crypto": false }


ERROR in ../../node_modules/web3-providers-http/lib/index.js 26:11-26

Module not found: Error: Can't resolve 'http' in 'C:\Users\Asus\Desktop\nzl swap 1.0\my-eth-app\node_modules\web3-providers-http\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
  - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
  - install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
  resolve.fallback: { "http": false }


ERROR in ../../node_modules/web3-providers-http/lib/index.js 27:12-28

Module not found: Error: Can't resolve 'https' in 'C:\Users\Asus\Desktop\nzl swap 1.0\my-eth-app\node_modules\web3-providers-http\lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
  - add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
  - install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
  resolve.fallback: { "https": false }

Package.json

{
  "name": "@my-app/monorepo",
  "version": "1.0.0",
  "keywords": [
    "ethereum",
    "react",
    "workspaces",
    "yarn"
  ],
  "private": true,
  "scripts": {
    "react-app:build": "yarn workspace @my-app/react-app build",
    "react-app:eject": "yarn workspace @my-app/react-app eject",
    "react-app:ipfs": "yarn workspace @my-app/react-app ipfs",
    "react-app:start": "yarn workspace @my-app/react-app start",
    "react-app:test": "yarn workspace @my-app/react-app test"
  },
  "workspaces": {
    "packages": [
      "packages/*"
    ]
  },
  "resolutions": {
    "react-error-overlay": "6.0.9"
  },
  "devDependencies": {
    "@babel/core": "^7.20.5",
    "@babel/preset-env": "^7.20.2",
    "assert": "^2.0.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^9.1.0",
    "babel-preset-react": "^6.24.1",
    "buffer": "^6.0.3",
    "crypto-browserify": "^3.12.0",
    "https-browserify": "^1.0.0",
    "os-browserify": "^0.3.0",
    "process": "^0.11.10",
    "react-app-rewired": "^2.2.1",
    "react-scripts": "^5.0.0",
    "stream-browserify": "^3.0.0",
    "stream-http": "^3.2.0",
    "url": "^0.11.0",
    "webpack": "^5.75.0",
    "webpack-config": "^7.0.0",
    "webpack-fix-style-only-entries": "^0.6.1"
  },
  "dependencies": {
    "cipher-base": "^1.0.4",
    "ipfs-deploy": "12.0.1",
    "node-polyfill-webpack-plugin": "^2.0.1",
    "swr": "^2.0.0",
    "util": "^0.12.5"
  }
}

我尝试了Stack Overflow等网站上的解决方案,但仍未找到解决办法。


内容的提问来源于stack exchange,提问作者Eren Ctnds

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 03:31:12