fkhadra / react-toastify

React notification made easy 🚀 !
https://fkhadra.github.io/react-toastify/introduction
MIT License
12.72k stars 700 forks source link

Error in DefaultTransition.js #52

Closed pratikborsadiya closed 7 years ago

pratikborsadiya commented 7 years ago

There is an error while running webpack in production mode webpack -p when using react-toastify.

react-toastify version

+-- react-toastify@2.1.0 
  `-- react-transition-group@2.2.1 

Webpack Version: webpack 3.6.0

ERROR in ./node_modules/react-toastify/lib/DefaultTransition.js
Module not found: Error: Can't resolve 'react-transition-group/Transition' in '/home/pratik/Projects/watercart/node_modules/react-toastify/lib'
 @ ./node_modules/react-toastify/lib/DefaultTransition.js 13:18-62
 @ ./node_modules/react-toastify/lib/ToastContainer.js
 @ ./node_modules/react-toastify/lib/index.js
 @ ./client/admin/admin-app.js
 @ ./client/admin/admin.js
fkhadra commented 7 years ago

Hello,

Did you had an old version of react-transition-group installed previously ?

pratikborsadiya commented 7 years ago

No it's a fresh npm install. I ran npm list react-transition-group and here is the output.

+-- react-addons-css-transition-group@15.6.2
| `-- react-transition-group@1.2.1 
`-- react-toastify@2.1.0
  `-- react-transition-group@2.2.1 

It seems that other packages in my app are using the old version.

fkhadra commented 7 years ago

Indeed. But it's working on development right ? Are you using yarn ? If yes you can solve your issue easily. Yarn allow you to use different version of the same package via aliases.

pratikborsadiya commented 7 years ago

We are using npm and it's not working in devlopment either.

pratikborsadiya commented 7 years ago

Is there any other way except manually installing react-transition-group?

fkhadra commented 7 years ago

You could try to use the react-toastify v2.0.0 so you won't have to do manual changes. The v2.1 is tested with enzyme 3, react16 and provide custom animation.

The other solution would be to use symlinks

pratikborsadiya commented 7 years ago

I have downgraded the version to 2.0.0 but the error is sill there.

fkhadra commented 7 years ago

Damn it. You will have to use symlink or replace react-addons-css-transition-group by react-transition-group since react-addons-css-transition-group is deprecated.

pratikborsadiya commented 7 years ago

The error is gone in 2.0.0 It was ^ in package which was installing 2.1.0, I have replaced it with ~ and version 2.0.0 is working fine.

Thanks for the help.

fkhadra commented 7 years ago

Awesome !

indreklasn commented 6 years ago

This issue still exists.

fkhadra commented 6 years ago

Hello @wesharehoodies,

Could you give the version of react-toastify you are using? Are you upgrading or is it a fresh install.

Thanks

indreklasn commented 6 years ago

"react-toastify": "^3.2.2",

It's a fresh install

fkhadra commented 6 years ago

Are you using another version of react-transition-group inside your project?

indreklasn commented 6 years ago

I removed react-transition-group and replaced it with react-addons-css-transition-group and it works.

Both packages were the latest.

hyperh commented 6 years ago

Same issue.

I dont have react-transition-group in my npm dependencies. I already have react-addons-css-transition-group in my npm dependencies.

EDIT: Fixed by

  1. Upgrading to "react-toastify": "^4.0.0-rc.4
  2. Removing react-addons-css-transition-group from my npm deps
  3. Adding "react-transition-group": "^2.3.1" to my npm deps