小编Pra*_*r2k的帖子

使用 React 时导入 IPFS 时出错

我无法导入 IPFS,因为一些 Webpack 错误。我真的不知道如何修复它们,但在搜索了一些信息后,我认为这与 Webpack 5 有关。我执行了以下步骤:

npx create-react-app test-app
cd test-app
npm install ipfs
Run Code Online (Sandbox Code Playgroud)

然后我在 App.js 中导入 IPFS:

import Ipfs from 'ipfs';
Run Code Online (Sandbox Code Playgroud)

当我执行时,npm start我收到以下错误:

Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

Module build failed: UnhandledSchemeError: Reading from "node:https" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by …
Run Code Online (Sandbox Code Playgroud)

reactjs webpack js-ipfs

6
推荐指数
1
解决办法
4071
查看次数

标签 统计

js-ipfs ×1

reactjs ×1

webpack ×1