0

I've been playing with rails-react and it works great. Recently I added the react-dropzone library in my package.json.

I get the following error when I run npm install:

npm WARN EPEERINVALID react-dropzone@3.2.2 requires a peer of react@^0.14.0 but none was installed.

If I explicitly add react it installs everything just fine.

However when I go into the browser, I get the following error:

enter image description here

Using react-rails (1.5.0) and "react-dropzone": "^3.2.2"

PericlesTheo
  • 2,429
  • 2
  • 19
  • 31

1 Answers1

0

I found a workaround in this post. Massive thanks to the author.

The problem is the fact that both rails-react and the react-dropzone include react.

So, instead we can remove the #= require react that comes from the gem and instead use the react library

Other than some depreciation warning, everything else seem to work fine.

In application.js, remove the #= require react and #= require react_ujs.

In the components.js

//= require_self
//= require react_ujs

React = require('react');

In your components you can now require react var React = require('react');

PericlesTheo
  • 2,429
  • 2
  • 19
  • 31
  • For posterity, could you include the relevant parts of the link which you found useful in your answer? That way, if the link goes down, changes, etc., your answer won't be rendered useless. Many thanks. – Wai Ha Lee Dec 12 '15 at 21:39