AppliedMathematicsANU / plexus-form

A dynamic form component for react using JSON-Schema.
MIT License
134 stars 31 forks source link

Yields `Invariant Violation...` when installed through NPM #2

Closed bebraw closed 10 years ago

bebraw commented 10 years ago

I'm getting Uncaught Error: Invariant Violation: EventPluginRegistry: Cannot inject event plugin ordering more than once. when using NPM version of the library. If I copy the library and import it then, everything works.

I've set up a demo at require_issue. Please run gulp compile and gulp to see it in action. You can adjust src/js/app.js to point at the included version of plexus-form simply by doing var Form = require('./plexus-form');.

Either I have configured the build wrong somehow or there's some glitch in the library. Just thought to bring this out.

Besides this and #1 the library seems to do the job well.

odf commented 10 years ago

Thanks for that! This issue here seems to be that plexus-form is locked to React 0.9.0, whereas you require 0.10.0 or later. This results is npm installing two different versions of React, and I'm assuming this means that React's initialisation code is run twice.

A workaround is to delete ./node_modules/plexus_form/node_modules/react after running npm install. The best fix is probably not to lock the library to a specific version of React. The reason I did it, I think, was some vague worry about potential API changes, since it's a pre-1.0.0 version.

odf commented 10 years ago

I've loosened the dependency requirement for React in a8c8c79fcf05c4535a4950b90c1e4e58f334bd83, but I'll leave this open until we've verified that the change fixes the issue.

bebraw commented 10 years ago

@odf No such luck yet. According to definition tilde matches only within the given series (ie. 0.9 in this case). This means you would have to bump the minor version for this to work or loosen up the definition. ^ would work but that's possibly a little risky if the API breaks too badly.

odf commented 10 years ago

How embarrassing! Well, I'll just have to go to 0.10.0 then.

odf commented 10 years ago

Requiring react 0.10.0 as of b465d3851600f9db86ab31f20456c3ba60b7d282.

odf commented 10 years ago

(Better leave this open until the change gets published to npm.)

odf commented 10 years ago

I've published Version 0.0.13 to npm today, so all should be well now.

bebraw commented 10 years ago

Thanks. Works great. Demo: http://koodilehto.github.io/invoice-frontend/ .