# --save VS --save-dev

When installing npm packages, there are two options provided:

* **—save (-S)**
    
* **—save-dev (-D)**
    

So what is the diff?

## **npm install &lt;package&gt; —save**

* Is equivalent to **npm install &lt;package&gt;**, which is the default behavior.
    
* It install the package under **node\_modules**, and add the package’s version information into the **package.json’s dependencies.**
    

## **npm install &lt;package&gt; —save-dev**

* Not the default behavior, === **npm install &lt;package&gt; -D**.
    
* It install the package under **node\_modules**, and add the package’s version information into the package.json’s ***devDependencies*.**
    
* These packages would not be install in **prod env.**
    
* Suitable for packages that would only be used in **dev env**, like eslint, webpack, @types/react (type definition packages, provided by TS community)
    

### Note: the reason @types/react exist only in the dev env is

* Type definitions are only used during development to provide code hints and type checking
    
* These type definitions are not needed in the production environment
    
* All type information is removed in the compiled JavaScript code
