我正在尝试在我的 React 项目中使用一个包,该包允许我进行 API 调用(axios、node-fetch、got 等)\n当这些包未安装时,应用程序将正常运行。当安装并在代码中调用其中任何一个时,我面临如下错误:
\n\n忽略警告,我相信问题的根源在于以下输出:
\nFailed to compile.\n\nModule build failed: UnhandledSchemeError: Reading from "node:buffer" is not handled by plugins (Unhandled scheme).\nWebpack supports "data:" and "file:" URIs by default.\nYou may need an additional plugin to handle "node:" URIs.\nRun Code Online (Sandbox Code Playgroud)\n我尝试了一切。重新安装了node_modules。创建了一个干净的测试应用程序,在那里进行了尝试。我也做了研究,没有找到任何相关的、明确的解决方案。没有任何帮助。
\n我究竟做错了什么??
\nDomException 文件内容:
\n/*! node-domexception. MIT License. Jimmy W\xc3\xa4rting <https://jimmy.warting.se/opensource> */\n\nif (!globalThis.DOMException) {\n try {\n const { MessageChannel } = require(\'worker_threads\'),\n port = new MessageChannel().port1,\n ab = new ArrayBuffer()\n port.postMessage(ab, [ab, ab])\n } …Run Code Online (Sandbox Code Playgroud)