Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install bower using -g vs --save-dev

I'm new to node and using npm to both do some node, angular and Express tutorials. I have used bower before in a tutorial. I'm pretty sure I have installed it using -g already as when i run the bower -v command I get back 1.3.3 I am to understand that installing it using -g means, Install this globally so that on the next project I don't have to install it again.

1) Is this correct?

2) When I start working with a new project do I have to initialize bower?

3) Is there any reason I should use install bower --save-dev after I have already installed bower (-g)lobally?

4) What exactly does install bower --save-dev do?

I have searched and get nothing on google or stack over flow when I search "--save-dev".

I really want to understand this and if you help me, it will help me understand installing much more than just bower and how to use those installs. Again, I'm new to the command line for this type of development and new to these technologies, but have some basic understanding.

like image 206
Eric Bishard Avatar asked Aug 02 '14 07:08

Eric Bishard


People also ask

Do I need to use the -- save with npm install?

As of npm 5.0. 0, installed modules are added as a dependency by default, so the --save option is no longer needed.

What is the difference between npm install -- Save and npm install?

It has a very frequently used command npm install [Package Name] –save. But the fact is there is no difference between npm install [Package Name] and npm install [Package Name] –save in the later version after npm 5.0. 0 onwards.

What is npm install -- Save Dev?

npm install [package-name] –save-dev: When –save-dev is used with npm install, it signifies that the package is a development dependency. A development dependency is any package that absence will not affect the work of the application.


Video Answer


1 Answers

Using the --save and --save-dev flags when installing will add them to the project's package.json. This allows anyone who might develop on or use the project to install the dependencies as needed with a simple npm install command. By contrast, the -g flag is global only to your local machine.

like image 85
SamT Avatar answered Oct 20 '22 04:10

SamT