Module not found: Can't resolve 'bootstrap/dist/css/bootstrap.min.css' in

See original GitHub issue

I think I have an obscure "where to put things’ #newbie question: in this package

it says “Import Bootstrap CSS in the src/index.js file:” import ‘bootstrap/dist/css/bootstrap.min.css’; …

but when I do this I’m getting

Module not found: Can't resolve 'bootstrap/dist/css/bootstrap.min.css' in '/Users/jason/Work/[XXX]/[xxx].com-front/client/src'

even though I downloaded boostrap 4 and put the CSS files into this location — /client/src/bootstrap/dist/css/bootstrap.min.css

did a miss a step? I don’t understand why bootstrap.min.css is referenced but not explicitly added to the project in the setup instructions.

my App.js file looks like

import React, { Component } from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';

import { Button } from 'reactstrap';

class App extends Component {
  state = {cities: []}
  async componentDidMount() {
    const response = await fetch('/cities')
    const cities   = await response.json()
    this.setState({cities: cities})
  }
  render() {
    return (
      <div>
        <header>

        </header>
        <Button color="danger">Danger!</Button>
        <ul>
        {this.state.cities.map( city => {
            return <li key={city.name}> <b>{city.name}</b>: {city.population}</li>
          })}
        </ul>
      </div>
  );
  }
}
export default App;

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

44reactions
TheSharpieOnecommented, Dec 18, 2018

import 'bootstrap/dist/css/bootstrap.min.css'; is referencing the file from node_modules. You will need to npm install bootstrap to put it in your node_modules.

-OR-

even though I downloaded boostrap 4 and put the CSS files into this location — /client/src/bootstrap/dist/css/bootstrap.min.css

If this is the case, you can reference it with a relative path: import './bootstrap/dist/css/bootstrap.min.css';

34reactions
kannan007commented, Sep 3, 2019

@youngheart12 Am still facing the issue if I import like this import './bootstrap/dist/css/bootstrap.min.css';

however, if I insert like below it works fine

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Module not found: Can't resolve 'bootstrap/dist/css ...
Looks like after installing the import isn't needed for it to load bootstrap styles correctly. So if you are having trouble with this,...
Read more >
Module not found: Can't resolve bootstrap/dist/css/bootstrap ...
To solve the error "Module not found: Error: Can't resolve 'bootstrap/dist/css/bootstrap.min.css'", make sure to install the bootstrap package by opening your ...
Read more >
[Solved]-Module not found: Can't resolve 'bootstrap/dist/css ...
This occurs either because the installation of a library wasn't successful, i.e. bootstrap had an issue installing within your node_modules directory, or your ......
Read more >
Can&#38;#039;t resolve Bootstrap.
Actual behavior I'm getting the following error message Module not found: Error: Can't resolve I have checked and bootstrap.scss is in fact in...
Read more >
can't resolve 'bootstrap/dist/css/bootstrap.css' - You.com
Run npm install command again. · Try delete the entire npm_modules folder and run npm install . · Try reinstalling bootstrap. · Make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found