After using the command npm i -g bootstrap
to install bootstrap
, I attempted to include it in a React-app by adding
import "bootstrap/dist/css/bootstrap.css";
.
Unfortunately, this resulted in an error being thrown.
Failed to compile.
./src/index.js
Module not found: Can't resolve 'bootstrap/dist/css/bootstrap.css' in '/home/username/nodeProjects/react-app/src'
However, upon installing it locally with npm i bootstrap
and importing it as
import "bootstrap/dist/css/bootstrap.css";
, it functioned correctly.
I'm wondering if there is a specific method for importing npm
packages when they are installed either globally or locally, or if I am making a mistake somewhere?