I am converting an existing Vue project to vue-cli 3 and have run into an unexpected problem:
In a .js file, I get this error (when I run npm run serve
) for the line import 'bootstrap/dist/css/bootstrap.css';
error: 'bootstrap' should be listed in the project's dependencies. Run 'npm i -S bootstrap' to add it (import/no-extraneous-dependencies) at src\main.js:19:1:
Which I don't understand, because my package.json
already has bootstrap:
"dependencies": {
"axios": "^0.18.0",
"bootstrap": "^4.1.3",
"bootstrap-vue": "^2.0.0-rc.11",
"jquery": "^3.3.1",
"popper": "^1.0.1",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
The vue-cli doc mentions using a tilde to mean "import from a node module", so I also tried
import '~bootstrap/dist/css/bootstrap.css';
-- and got the same error.
main.js
file? – Bennett Damsnode_modules
folder and runnpm install
afterwards? – Bennett Dams