19

I am trying to include bootstrap 3.7 in my angular 2 project by using Angular CLI command -

npm install bootstrap --save

I have requirement to use bootstrap 3.7 version. But, it is installing the latest version of bootstrap i..e bootstrap 4.

How to install specific version of bootstrap using Angular CLI?

TheUnreal
  • 21,504
  • 41
  • 145
  • 251
Guruling Kumbhar
  • 969
  • 1
  • 7
  • 17
  • 1
    Possible duplicate of [How do I install a previous version of an npm package?](https://stackoverflow.com/questions/15890958/how-do-i-install-a-previous-version-of-an-npm-package) – Jota.Toledo Jan 24 '18 at 18:19

7 Answers7

52

From the official bootstrap documentation :

You can also install Bootstrap using npm:

npm install bootstrap@3 --save

Rafik Tighilt
  • 1,963
  • 1
  • 13
  • 27
10

This is related to NPM, not angular. There are 2 ways:

  1. npm install bootstrap@version --save(replace version with the desired version). Using --save is a best pratice. It adds the bootstrap dependencies to package.json
  2. Check your package.json and update "bootstrap": "4.0.0" to 3.3.7
Dexter
  • 3,476
  • 3
  • 42
  • 53
TheUnreal
  • 21,504
  • 41
  • 145
  • 251
6

You Can install Bootstrap Version 3.3.7 using below comment.

$ npm install bootstrap@3.3.7 --save

3

Specify the version you want in the 'dependencies' section of your package.json, then from your root project folder in the console run this:

npm install

Sajeetharan
  • 203,447
  • 57
  • 330
  • 376
  • I have noticed that everyone uses 'npm install bootstrap'. why not 'npm install --save bootstrap'? Will it not throw an error when the codebase is shared with some other developer as it will not be added in package.json but is being referencecd in angular.json file. PS. I am new to angular 7. Just curious to know why people dont use --save for this package – prawwe316 Mar 06 '19 at 18:52
2

Use following command:

npm install bootstrap@version --save

Replace the version with the respective version you need. See the example below to install v.3.3.7

npm install bootstrap@3.3.7 --save
Basil
  • 1,562
  • 12
  • 19
1

You can install bootstrap using npm command.

npm install bootstrap@version --save

Here "@version" is the version of bootstrap. You can replace it by specific version as below.

npm install bootstrap@3.7 --save

You can also use @latest to install latest version of it.

Mohit Bhavsar
  • 361
  • 1
  • 5
0

Install Bootstrap Specific Version in Angular

npm install bootstrap@4.6 --save // 4.6 is a version value you can change it accordingly.

If you like to install bootstrap along with JQuery in Angular

npm install bootstrap@@4.6 jquery --save

Note: you can try without --save also.

dev
  • 2,150
  • 20
  • 40