gpt4 book ai didi

reactjs - 不支持 Uncaught Error : process. 绑定(bind)(在 React、fluxible 和 Electron 中开发时)

转载 作者:行者123 更新时间:2023-12-03 12:36:40 46 4
gpt4 key购买 nike

我正在使用 React & Fluxible & electron 处理应用程序流程,它遵循标准的 react 流程,即 component -> action -> store -> component

  • 点击一些 React 组件,这会触发 ActionActionCreators
  • Action会做fs.readfileSync并将“完成”发送到 store
  • React 组件将看到 store 中的更改并渲染 component再次。

  • 当我即将将文件读入应用程序时,我在第 2 步失败了。它给了我一条错误消息:
    Uncaught Error: process.binding is not supported

    我想知道我是否做错了什么?谢谢。

    最佳答案

    fs 模块将无法在客户端上运行。您应该将文件访问权移至仅作为服务器的位置,并通过 XHR 端点公开它。如果您使用fluxible-plugin-fetchr,您可以在服务中执行此操作并从您的操作创建者处调用该服务。

    关于reactjs - 不支持 Uncaught Error : process. 绑定(bind)(在 React、fluxible 和 Electron 中开发时),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31065142/

    46 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com