Nitesh Singh
Nitesh Singh

Reputation: 57

Unable to import bootstrap.css in react

Everyone I was trying to build a tic Tac toe game, but in my project I am getting this error I do not know how to solve it, can somebody help why it is showing like this (Please check attached image)

import logo from './logo.svg';
import './App.css';
import Icon from "./components/icon"
import { icons } from 'react-icons';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import {Card,CardBody,Container,Button,Col,Row } from "reactstrap";
import 'bootstrap/dist/css/bootstrap.css';

const itemArray = new Array(9).fill("empty")
function App() {
  return (
    <div className="App">
      <header className="App-header">
        <p>
          Edit <code>src/App.js</code> and save to reload.
        </p>
        <Icon name="circle"/>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}

export default App;

enter image description here

Upvotes: 0

Views: 2807

Answers (3)

ELBEQQAL
ELBEQQAL

Reputation: 46

The same directory is wrong can you try this: '~bootstrap/dist/css/bootstrap.css'

Upvotes: 1

CodeTech
CodeTech

Reputation: 166

Sounds like NodeJS detected that your module is not installed. Use npm install bootstrap and check how to import correctly the module. Follow the bootstrap website: https://getbootstrap.com/docs/5.0/getting-started/download/

If it is still not working, just use the CDN. It's lightweight and easy to implement.

Upvotes: 1

sirius9515
sirius9515

Reputation: 509

Seems like you have installed bootstrap in a wrong way. I suggest to check if there is actually bootstrap module in node_module folder.

If it does not work, this seems to be old fashioned way but still a worthy try. Just include bootstrap.css file in public/index.html file. I mean in the <head> tag.

Upvotes: 0

Related Questions