Uncaught Error: process.binding is not supported (when developing in React, fluxible and electron)

8k views Asked by At

I was using React & fluxible & electron to work on on the app flows and it follows the standard react flow, i.e, component -> action -> store -> component

  1. click on some React components and this triggers an Action in ActionCreators
  2. Action will do fs.readfileSync and dispatch 'done' to the store
  3. the React component will see the change in the store and renders the component again.

I failed at step 2 when I was about to read a file into the app. It gives me an error message saying:

Uncaught Error: process.binding is not supported

And I wonder if I did something wrong? Thanks.

1

There are 1 answers

4
Michael Ridgway On

The fs module will not work on the client. You should move file access to a place that is server only and expose it via an XHR endpoint. If you are using fluxible-plugin-fetchr you can do this within a service and call the service from your action creator.