close

[Solved] Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’

I am Just added bootstrap in my reactjs app But I am facing the following error Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’ in ReactJS. We are going to Learn about All Possible Solutions So Lets Get Start with This Article.

How Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’ Error Occurs ?

I am Just added bootstrap in my reactjs app But I am facing the following error.

Module not found: Can't resolve 'bootstrap/dist/css/bootstrap-theme.css'

So here I am writing all possible solutions that I have tried to resolve this error.

How To Solve Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’ Error ?

  1. How To Solve Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’ Error?

    To Solve Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’ Error In order to solve this error you just need to downgrade Bootstrap to version 3. Install React Bootstrap and Bootstrap from npm. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well: npm install –save react-bootstrap bootstrap@3 Or If you are Yarn User then run this command: yarn add react-bootstrap bootstrap@3 Now, Your error must be solved.

  2. Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’

    To Solve Module not found: Can’t resolve ‘bootstrap/dist/css/bootstrap-theme.css’ Error Just try to reinstall bootstrap. But First of all, You need to delete node_modules directory from the project and then install bootstrap with the below command. Just run this command in your terminal: npm install Then Install bootstrap with this command: npm i bootstrap Now, import bootstrap in this way: import ‘bootstrap/dist/css/bootstrap.min.css’; Now, Your error must be solved.

Solution 1: Reinstall bootstrap

Just try to reinstall bootstrap. But First of all, You need to delete node_modules directory from the project and then install bootstrap with the below command. Just run this command in your terminal.

npm install 

Then Install bootstrap with this command.

npm i bootstrap

Now, import bootstrap in this way.

import 'bootstrap/dist/css/bootstrap.min.css';

Now, Your error must be solved.

Solution 2: Use Bootstrap 3

In order to solve this error you just need to downgrade Bootstrap to version 3.

Install React Bootstrap and Bootstrap from npm. React Bootstrap does not include Bootstrap CSS so this needs to be installed as well.

npm install --save react-bootstrap bootstrap@3

Or If you are Yarn User then run this command.

yarn add react-bootstrap bootstrap@3

Now, Your error must be solved.

Solution 3: Use bootstrap-theme.css file removed

If You are using BootStrap 4 Then they have removed ‘bootstrap-theme.css’ file and If you want to use version 4 remove the import this and then your error will be fixed.

Summary

It’s all About this error. Hope We solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment