This article will explain why the errorModule not found: Can’t resolve ‘reactstrap’” happens and how to fix it using install reactstrap or checking your dependencies method. Let’s go into detail now.

## Why do you get the error “Module not found: Can’t resolve ‘reactstrap’“?

Bootstrap 5.1 and reactstrap are currently compatible. You will need to use reactstrap if you use Bootstrap 4. You should install this library when you have installed the react-bootstrap library to use it the whole way. This error will appear like the example below if you still need to install the reactstrap package and import its modules.

Code:

import React from 'react';
import { Button } from 'reactstrap';

const App = () => {
return (
<div>
<Button color="danger">Danger!</Button>
</div>
);
};

export default App;

Output:

How do we fix the error “Module not found: Can’t resolve ‘reactstrap'”? Let’s follow the methods below to fix it.

## Solutions to fix this error

### Install @babel/runtime

This error can appear when your project is missing the specific package reactstrap, so you can fix this problem by reinstalling it. You can install this package with either of the following commands depending on whether you are using npm or yarn.

Terminal:

npm install reactstrap react react-dom
yarn add reactstrap

After running the command, you wait until the program completes, and then you rerun the program with the command “npm start” and see if the program still shows the error. If it is still there, you can refer to the method below.

If you have installed the package and still show an error when running the program, you can check your dependencies in the package.json file to see if you have installed the correct version of the library or not. There are some cases when you have installed the library, but the dependencies still need to be corrected with the library version. What should you do?

Code:

"dependencies": {
"bootstrap": "^5.2.3",
"react": "^18.2.0",
"react-bootstrap": "^2.6.0",
"reactstrap": "^9.1.5",
}

The above code is what I got in the project after installing reactstrap, and my program can generally run. The time I received this version is 11/2022. You can manually add dependencies if your project does not show the latest version after installation. Hope the above methods are helpful to you

## Summary

In summary, to fix the error “Module not found: Can’t resolve ‘reactstrap’“, we have two ways mentioned in the article. However, we recommend installing the package to get the most thorough fix. Wish you a good day!

Maybe you are interested: