elementalui / elemental

A flexible and beautiful UI framework for React.js
elemental-ui.com
MIT License
4.31k stars 216 forks source link

Error: Cannot resolve module 'react-addons-css-transition-group' #192

Closed agutierrezcu closed 7 years ago

agutierrezcu commented 7 years ago

I've added elemental to my react based project. After create a simple form using its handy components I got the error below when i build the application using webpack:

**ERROR in .//elemental/lib/components/Dropdown.js Module not found: Error: Cannot resolve module 'react-addons-css-transition-group' in C:_D\Armando_Work\github-agutierrezcu\WeatherApp\node_modules\elemental\lib\components @ ./~/elemental/lib/components/Dropdown.js 6:17-61

ERROR in .//elemental/lib/components/Modal.js Module not found: Error: Cannot resolve module 'react-addons-css-transition-group' in C:_D\Armando_Work\github-agutierrezcu\WeatherApp\node_modules\elemental\lib\components @ ./~/elemental/lib/components/Modal.js 15:37-81**

I tried to force reinstalling all dependencies and I noticed this warning

Unmet peer dependency "react-addons-css-transition-group@^0.14.0 || ^15.0.0"

After a while looking for a fix on internet I installed react-addons-css-transition-group as a direct project's dependency and everything worked as expected.

The problem might be related with the versions installed on my project and it's possible there is an easier way to solve that configuring dependencies on the right way.

Project's dependencies from package.json: ... "dependencies": { "check-types": "^7.0.1", "elemental": "^0.6.1", "react": "^15.4.2", "react-dom": "^15.4.2", "react-redux": "^5.0.1", "react-router": "^3.0.0", "react-router-redux": "^4.0.7", "redux": "^3.6.0", "redux-immutable": "^3.0.9", "redux-saga": "^0.14.2", "styled-components": "^1.3.0" }, ... node version: v7.2.1 npm version: 4.0.5 webpack : 1.14.0

Regards

wlalele commented 7 years ago

+1

sktt commented 7 years ago

I think this is intentional to avoid running two versions of the dependency in the same project.

https://stackoverflow.com/questions/26737819/why-use-peer-dependencies-in-npm-for-plugins

Cheers

agutierrezcu commented 7 years ago

Thanks @sktt for shares the link!

I think I got it! ;)