This article will show you how to fix Module not found: Can’t resolve ‘react-transition-group’ error in some ways, such as installing ‘react-transition-group’ package or checking dependencies in the package.json file. Let’s go into detail now.
What causes the Module not found: Can’t resolve ‘react-transition-group’?
When working with Javascript, applying the most recent syntax can sometimes be annoying because the code can run in one browser but fail in another, or the same browser with the most recent version works fine but is stuck on a lower version because it isn’t supported yet.
React-transition-group is a library developed by the React developer community. This library supports and provides developers with the components needed to create effects and interact more easily with CSS Transition in a React application.
The library provides the main components such as:
- Transition
- CssTransition
- TransitionGroup
Code:
import { CSSTransition } from 'react-transition-group';
Output:

Module not found: Can’t resolve ‘react-transition-group’ error occurs when webpack can’t find react-transition-group module in your project, so how can you fix this?
How to fix this error?
Installing react-transition-group package
Because webpack reports the program is missing the react-transition-group package, so the easiest way to fix this error is reinstalling this package. You can install it with the npm or yarn command as follows:
Terminal:
npm i react-transition-group
yarn add react-transition-group
When you run this command in the terminal, wait until the program has finished installing the package for the project, and then run the project and see the result.
Code:
import React, { useState, useRef } from 'react'; import { Container, Button, Alert } from 'react-bootstrap'; import { CSSTransition } from 'react-transition-group'; import 'bootstrap/dist/css/bootstrap.min.css'; import './App.css'; const App = () => { const [button, setButton] = useState(true); const [showAlert, setShowAlert] = useState(false); const nodeRef = useRef(null); return ( <Container style={{ paddingTop: '2rem' }}> {button && ( <Button onClick={() => setShowAlert(true)} size= "lg" > Show Message </Button> )} <CSSTransition in={showAlert} nodeRef={nodeRef} timeout={300} classNames= "alert" unmountOnExit onEnter={() => setButton(false)} onExited={() => setButton(true)} > <Alert ref={nodeRef} variant= "primary" dismissible onClose={() => setShowAlert(false)} > <Alert.Heading> Alert message </Alert.Heading> <p> This is an alert message. </p> </Alert> </CSSTransition> </Container> ); }; export default App;
Output:

Once the react-transition-group module is installed, webpack can detect that you have fully configured react-transition-group and run the program normally. If not, the error still appears. You can refer to the following methods.
Checking the dependencies in the package.json file
Or you can check the dependencies in the project’s package.json file to see if it’s in the form below.
Code:
"dependencies": { "react-router-dom": "^6.4.3", "react-scripts": "5.0.1", "react-transition-group": "^4.4.5", }
At the time of writing, react-transition-group is on version 4.4.5, and if you install it, you can go to the library’s homepage to see the latest version of the package so you can easily update it. Good luck with these methods.
Summary
To summarize, this article has shown you how to fix the Module not found: Can’t resolve ‘react-transition-group’ error. Reinstalling the react-transition-group library will be the most comprehensive. Let’s try it to get your desired results! Have a nice day.
Maybe you are interested:
- Module not found: Can’t resolve ‘reactstrap’
- Module not found: Can’t resolve ‘babel-loader’
- Module not found: Can’t resolve ‘moment’ error

Hi, my name’s Nathaniel Kirk. I’m interested in learning and sharing knowledge about programming languages. My strengths are C, C++, Python, HTML, CSS, Javascript, and Reactjs. If you have difficulty with them, don’t worry. I’m here to support you.
Name of the university: PTIT
Major: IT
Programming Languages: C, C++, Python, HTML, CSS, Javascript, Reactjs