7

When I was going through on configuring bootstrap in angularjs 2, I came across the below step in this link,

How to add bootstrap to an angular-cli project

npm i bootstrap@next

I understand if we run the below command,

npm i -S bootstrap@4.0.0-alpha.4 

Then this will install bootstrap alpha version. But if we give @next, which version will be installed ?

Also what --save with @next like,

npm i bootstrap@next --save

which is recommended ? and also how can we confirm the version of the installed version ?

Community
  • 1
  • 1
Naveen
  • 117
  • 2
  • 11

1 Answers1

9

using @ after an NPM package name denotes a version OR a tag

try npm view bootstrap you'll get this output:

note the tag next is for the version 4.0.0-alpha.6

docs for the view command: https://docs.npmjs.com/cli/view

{ name: 'bootstrap',
  description: 'The most popular front-end framework for developing responsive, mobile first projects on the web.',
  'dist-tags': { latest: '3.3.7', next: '4.0.0-alpha.6' },
  versions: 
   [ '0.0.1',
     '0.0.2',
     '3.1.1',
     '3.2.0',
     '3.3.0',
     '3.3.1',
     '3.3.2',
     '3.3.4',
   ...

as for --save or -S they are both aliases for the same thing read more here: https://docs.npmjs.com/cli/install from the npm install doc link above:

-S, --save: Package will appear in your dependencies.

Community
  • 1
  • 1
Ahmed Musallam
  • 9,523
  • 4
  • 27
  • 47
  • `@next` installs latest version available. Am I understanding correctly ?. If no, please help me to understand it better, sorry I am new to angular-cli. – Naveen Apr 10 '17 at 15:40
  • this completely unrelated to angular-cli. it's an NPM thing. The tag `next` is something the bootstrap team chose. I believe it just means the latest non-release ie, the latest beta version or release candidate version – Ahmed Musallam Apr 10 '17 at 15:45
  • also, I'd stay away from `@next` and `alpha` or `beta` versions because they are not stable. That, off course if you want to go to production with your app. If you understand the risks or you need a very specific feature that is in the `alpha` version, go ahead, But know that `alpha` versions constantly change and might creak your app's css – Ahmed Musallam Apr 10 '17 at 15:49
  • Ya I got you Ahmed. – Naveen Apr 10 '17 at 15:57
  • usually that is sound advice but bootstrap 4 has been in Alpha for over 18 months and we've been using it for 12 months with not a single issue... so I would have no problem using it in a production environment – 72GM Apr 11 '17 at 09:48
  • @72GM who's to say they wont push a new version tomorrow? In a week or in a month, you cant predict the future. Regardless, if you need to use alpha. Use the specific alpha version and not the "@next" tag. As the tag may point to a different version at some point. Its a good practice irrespective of how long it takes the bootstrap team to release a new version. – Ahmed Musallam Apr 11 '17 at 13:40
  • didn't say anything about using the '@next' tag (as '@next' isn't normal and should be ignored).... we always specify a specific version, whatever the product, whether its alpha/beta/coconut... i think you're splitting hairs for no apparent reason – 72GM Apr 12 '17 at 14:43
  • I think I addressed the question @72GM, thank you and have a nice day. – Ahmed Musallam Apr 12 '17 at 14:45