---
tags: _draft, npm
title: npm ci vs install
description: npm ci vs install
image:
author: Rupesh Tiwari
---
# npm ci vs install
## npm ci
> npm ci (**Continuous Integration**) bypasses a package’s package.json to install modules from a package’s lockfile. This ensures reproducible builds—you are getting exactly what you expect on every install.
`npm ci` is equivalent to `yarn install --frozen-lockfile`
### What npm ci does?
1. The project must have an existing **package-lock.json** or **npm-shrinkwrap.json**.
2. If dependencies in the **package-lock.json** do not match those in **package.json**, `npm ci` will exit with an error, instead of updating the package lock.
3. `npm ci` can only install entire projects at a time: individual dependencies cannot be added with this command.
4. If a node_modules is already present, it will be automatically removed before npm ci begins its install.
5. It will never write to package.json or any of the package-locks: installs are essentially frozen.
6. `npm ci` is significantly faster than `npm install` because it skips some features.
7. **npm ci** is clean state install is **great for ci/cd pipelines** and docker builds
8. If you do not have `package-lock.json` file and run `npm ci` then you will get an error
```error
C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" ci"
npm ERR! cipm can only install packages with an existing package-lock.json or npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or later to generate it, then try again.
```
### npm ci Algorithm
1. Load the existing node_modules tree from disk
2. Clone the tree
3. Fetch the package.json and assorted metadata and add it to the clone.
4. Walk the clone and add any missing dependencies
5. Dependencies will be added as close to the top as is possible
6. Without breaking any other modules
7. Compare the original tree with the cloned tree and make a list of
8. Actions to take to convert one to the other
9. Execute all of the actions, deepest first
10. Kinds of actions are install, update, remove and move
## npm install
1. Essentially, npm install reads package.json to create a list of dependencies and uses package-lock.json to inform which versions of these dependencies to install. If a dependency is not in package-lock.json it will be added by npm install.
2. Use `npm install` to add new dependencies, and to update dependencies on a project during development.
---
## Do You Want to become full stack developer? :computer:
If you want to become full stack developer and grow your carrier as Lead Developer/Architect. Consider subscribing to our full stack development training programs. We have monthly membership plans and you will get unlimited access to all of our video courses, slides, source code & Monthly video calls.
- Please visit www.fullstackmaster.net/pro to subscribe to All Access PRO membership.
- Please visit www.fullstackmaster.net/elite to subscribe to All Access ELITE membership. You will get everything from PRO plan. Additionally you will get access to monthly live Q&A video call with Rupesh and ask doubts and get more tips and tricks.
>You bright future is waiting for you so visit today www.fullstackmaster.net and allow me to help you to board on your dream software architect/lead role.
---
### :sparkling_heart: Contact Details: Say :wave: to me!
* Rupesh Tiwari
* www.rupeshtiwari.com
* :email: <fullstackmaster1@gmail.com>
* Founder of www.fullstackmaster.net :mortar_board:
* [<img src="https://i.imgur.com/9OCLciM.png" width="295" height="65">](http://www.fullstackmaster.net)