【发布时间】:2022-01-18 22:48:14
【问题描述】:
这是我得到的错误输出。我已经尝试创建一个 jsconfig.json 来执行错误描述的解决方案,但我太缺乏经验,无法理解发生了什么......
所有这些模块都安装在我的 node-modules 文件夹中。
我正在尝试使用 react truffle 和 web3js 构建一个 Dapp
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\gavin\WebstormProjects\untitled\blockchain\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 }
assets by status 6.88 KiB [cached] 1 asset
assets by chunk 4.86 MiB (name: main)
我得到的错误比这大得多,但 stackoverflow 不允许我发布整个内容。
【问题讨论】: