bootstrap@3 by mistake. I meant to install
I tried to uninstall with this cmd:
npm uninstall bootstrap@3 but that didn’t work. The version in
package.json and in
node_modules is version 3.
Does anyone know how I can switch from one version to another?
What do you mean by “that didn’t work”? Do you get an error, or are you saying it is just not removing the dependency from your
package.json file? If you install BootStrap4 using
npm, you should be able to just point to it in the
So I tried installing latest version with:
npm install bootstrap
The node_modules bootstrap folder’s bootstrap.css has this at the top:
Bootstrap v3.4.1 (https://getbootstrap.com/)
So I don’t think I can change the reference in
Just as an FYI, when you uninstall, you just
npm uninstall bootstrap, you don’t add the version number.
And as @Sky020 says, just install the specific version you want, it will overwrite what’s there already.
OK, and probably a dumb question, but the last step should be:
npm ci bootstrap ?
No need to put
bootstrap. Just run
After following all the steps, I checked this file again:
And it still says:
Do you think I should have changed the bootstrap version in
package-lock.json file too…?
PS - At this point, I think I will simply start a new project since I am at the beginning phase anyway and download correct version of BS but it would be nice to know how to fix this. Packages are such a mystery to me.
It changes the entry in package.lock if you change the version. Are you sure a. something else doesn’t have a dependency on bootstrap, and that’s the entry you’re looking at, or b. that you’ve saved a specific newer version (eg you should have done
npm install --save bootstrap). You are also fine to delete node modules and the lockfile, it’s not going to do any harm. So to make sure you are doing a clean install, delete the bootstrap entry in package.json, delete the modules folder, delete the lockfile, run
npm install --save bootstrap (this will get bootstrap 4.4.1, which is the latest version of the package on NPM)
Thanks everyone. I marked the last comment as solution but I think it was a group effort - thanks!