Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing module breaks build (create-react-app / webpack) #321

Closed
1 task done
sirreal opened this issue Sep 13, 2016 · 9 comments
Closed
1 task done

Importing module breaks build (create-react-app / webpack) #321

sirreal opened this issue Sep 13, 2016 · 9 comments

Comments

@sirreal
Copy link

sirreal commented Sep 13, 2016

Prerequisites

Description

import Form from 'react-jsonschema-form' breaks app.

Steps to Reproduce

  1. Initialize new project with create-react-app
  2. Install react-jsonschema-form dependency and use it in the project.
  3. Build/run app (npm start), open in browser to see error: `

Demo project available here: https://github.com/sirreal/broken-react-jsonschema-form
Relevant file: https://github.com/sirreal/broken-react-jsonschema-form/blob/master/src/App.js

The code is copied nearly verbatim from documentation:

import Form from "react-jsonschema-form";
const schema = {
  title: "Todo",
  type: "object",
  required: ["title"],
  properties: {
    title: {type: "string", title: "Title", default: "A new task"},
    done: {type: "boolean", title: "Done?", default: false}
  }
};
/* ... render() ... */
        <Form schema={schema}
          onChange={log("changed")}
          onSubmit={log("submitted")}
          onError={log("errors")}
        />
/* ... */

Expected behavior

See <Form /> component rendered

Actual behavior

App crashes with error:

browser.js:173 Uncaught Error: process.binding is not supported

Version

break-react-jsonschema-form@0.1.0
├── react@15.3.1
├── react-dom@15.3.1
├── react-jsonschema-form@0.40.0
└─┬ react-scripts@0.4.1
  └── webpack@1.13.2 
node --version
v6.5.0
npm --version
3.10.7
@n1k0
Copy link
Collaborator

n1k0 commented Sep 13, 2016

Well, works for me with the same CRA version...

Dunno where to look at to help you further.

@sirreal
Copy link
Author

sirreal commented Sep 13, 2016

I also have no problem on OSX.

I'll try npm cache clean and rebuilding on the other machine tomorrow (Linux).

@sirreal
Copy link
Author

sirreal commented Sep 14, 2016

There is clearly no problem with this module and there is something very strange going on with my machine.

FYI - reinstalling all modules (with npm cache clean) did not help.

Solution: run the same code in a docker container with the same version of node and everything works fine.

@sirreal sirreal closed this as completed Sep 14, 2016
@ghost
Copy link

ghost commented Nov 30, 2016

Could this be related to facebook/create-react-app#815?

@sirreal
Copy link
Author

sirreal commented Nov 30, 2016

@garudacrafts Yep, that's probably the culprit.

@ghost
Copy link

ghost commented Nov 30, 2016

@sirreal Another work around (other than running in a container), would be to identify which node module is falling back to the native copy and add it as a direct dependency in your node_modules. See the latest comments in facebook/create-react-app#1023.

@Rajat421
Copy link

hi i am having the same issue with this package , I am using
next-Framework 2.0.1
react@latest
npm -v 3.10.10
node -v 6.10.2
how should i resolve it,

@ghost
Copy link

ghost commented Apr 27, 2017

@Rajat421 As discussed in #1023, the issue was a system copy of a module was erroneously being used (e.g. in place of the copy installed as a dependency of another module in the project). This ended up happening with more than one module and it wasn't related to react-jsonschema-form or any other particular module. It was caused by a bug in react and the webpack build process. A workaround was to identify which module was doing this and install it as a direct dependency (simply npm install it to your project). You should be able to identify the culprit by investigating your stack trace. Another workaround was to unset NODE_PATH as per facebook/create-react-app#1023 (comment). Or you could try to re-install Node.js on your system using another method. But, I'm wondering why you're seeing this issue at all, since it was apparently fixed via facebook/create-react-app#1194. If you're still having problems related to this issue, then I'd suggest you post them there.

@ghost
Copy link

ghost commented Sep 30, 2019

If anyone is inquiring, yeah yarn is the same as npm :

 yarn cache clean

read this: https://yarnpkg.com/lang/en/docs/cli/cache/ .
Has a little bit more info on specific commands and what they do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants