导入"EventEmitter" "browser-external:events"中没有匹配的导出



我在reactJS应用程序中从@web3 react/injected连接器导入了InjectedConnector,用于将其连接到元掩码钱包,但在启动vite服务器时,我收到了此错误

✘ [ERROR] No matching export in "browser-external:events" for import "EventEmitter"
../../node_modules/@web3-react/abstract-connector/dist/abstract-connector.esm.js:1:9:
1 │ import { EventEmitter } from 'events';

知道这里出了什么问题吗??

这是显示的完整错误消息

error when starting dev server:
Error: Build failed with 1 error:
../../node_modules/@web3-react/abstract-connector/dist/abstract-connector.esm.js:1:9: ERROR: No matching export in "browser-external:events" for import "EventEmitter"
at failureErrorWithLog (/media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:1602:15)
at /media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:1248:28
at runOnEndCallbacks (/media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:1033:63)
at buildResponseToResult (/media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:1246:7)
at /media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:1355:14
at /media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:665:9
at handleIncomingPacket (/media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:762:9)
at Socket.readFromStdout (/media/naval/Data/IIIT/Year 2/Sem 2/DASS/OfficialRepo/Source Code/oyh/node_modules/esbuild/lib/main.js:632:7)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:315:12)

yarn add events解决了我的问题。

@web3-react/abstract-connector没有添加events作为依赖项,是否尝试从nodejs native解析dep?

相关内容

  • 没有找到相关文章

最新更新