Module not found: Can't resolve 'bootstrap/dist/css/bootstrap.min.css' in
See original GitHub issueI 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:
- Created 5 years ago
- Reactions:7
- Comments:18 (4 by maintainers)
Top 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&#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 >
Top Related Medium Post
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top Related StackOverflow Question
import 'bootstrap/dist/css/bootstrap.min.css';is referencing the file from node_modules. You will need tonpm install bootstrapto put it in your node_modules.-OR-
If this is the case, you can reference it with a relative path:
import './bootstrap/dist/css/bootstrap.min.css';@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';