【问题标题】:IPFS-JS with "npx create-react-app" causes a Webpack Error带有“npx create-react-app”的 IPFS-JS 导致 Webpack 错误
【发布时间】:2021-07-05 14:17:57
【问题描述】:

所以我创建了一个新的 React 项目

npx create-react-app

我加了

yarn add ipfs

我将它添加到 React 项目中

...
const createClient = require("ipfs");
function App() {
...

我得到了错误

TypeError: TextDecoder is not a constructor

我认为这与 Webpack 有关,并且可能与 JEST 的配置方式有关。关于它正在为浏览器设置的一些东西。

【问题讨论】:

    标签: reactjs webpack ipfs js-ipfs


    【解决方案1】:

    我遇到了类似的问题(“TypeError:TextDecoder 不是构造函数),但它是在尝试使用 ipfs-client-http 时。我找到了答案 - 无论如何对我来说 - 是回到 ipfs-client -http v33.1.1。

    所以我的建议是查看 ipfs-client-http 在 v33.1.1 的日期,然后卸载您的 ipfs 并从那时获取 ipfs。我的问题马上就解决了!

    祝你好运 克里斯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-21
      • 2022-06-28
      • 2018-11-05
      • 2021-04-24
      • 2021-03-03
      • 2021-09-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多