react-toastr icon indicating copy to clipboard operation
react-toastr copied to clipboard

not satisfy its siblings in peerDependencies requirements about react

Open AllenFang opened this issue 10 years ago • 4 comments

I use react-toastr@2.1.0 in my component react-bootstrap-table. In these day, I've upgraded react-bootstrap-table's react version to 0.14.0 and released. But I found if user use [email protected], there's some error about different version of React, cause of the siblings react version is higher that parent. So would you move react to the devDependency? Just like react-bootstrap or FB's fixed-data-table.

Anyway, great work BTW. This is useful component for me :)

AllenFang avatar Oct 13 '15 14:10 AllenFang

I think it's reasonable for a library to put react as peerDeps in this case. Putting them in deps might generate two or more versions of React and it's always hard to find out. I'd rather let people fix the problem beforehand.

For React 0.13, please use 1.x.x versions as described in CHANGELOG.md. I don't think there will be any feature update in the near future.

tomchentw avatar Oct 13 '15 15:10 tomchentw

I noticed that you're talking about devDependency. Interesting. Does it really make sense to put a strong dependency like React in devDependency?

tomchentw avatar Oct 13 '15 15:10 tomchentw

OK, I understand, thanks your response

AllenFang avatar Oct 13 '15 16:10 AllenFang

Actually, any major change to a peer dependency's version should result in a major version bump in the dependent. Making it a devDependency isn't necessary unless you really need it installed for the development tools to work.

I just stumbled upon this issue because apparently npm got me into a hellish dependency situation: while I'm using React 0.14.2 and your package is supposed to accept versions '^0.14.0 || ^15.0.0' of React, npm complained about an unmet peer dependency. I'd like to obtain some reasoning on this, as it could also be an issue of npm.

├─┬ [email protected] │ └─┬ [email protected] │ ├── [email protected] │ ├── UNMET PEER DEPENDENCY react@^15.0.2 │ └── [email protected]

I have also obtained this error message while calling npm ls:

npm ERR! peer dep missing: react@^15.0.2, required by [email protected]

My hunch is that npm chose to install react-addons-update@15 instead of the one that would be compatible with my project, resulting in this mess. Explicitly installing version 0.14.8 of this package at the root of my project solves the problem. Perhaps it would be more convenient to have this one in the list of peer dependencies as well. In fact, hadn't I installed react-dom explicitly, the same problem would've happened here.

In case I didn't make myself clear, react-addons-update and react-dom should be moved from "dependencies" to "peerDependencies" in this project.

Enet4 avatar May 06 '16 10:05 Enet4