1--- 2section: cli-commands 3title: npm-ci 4description: Install a project with a clean slate 5--- 6 7# npm-ci(1) 8 9## Install a project with a clean slate 10 11### Synopsis 12```bash 13npm ci 14``` 15 16### Example 17 18Make sure you have a package-lock and an up-to-date install: 19 20```bash 21$ cd ./my/npm/project 22$ npm install 23added 154 packages in 10s 24$ ls | grep package-lock 25``` 26 27Run `npm ci` in that project 28 29```bash 30$ npm ci 31added 154 packages in 5s 32``` 33 34Configure Travis to build using `npm ci` instead of `npm install`: 35 36```bash 37# .travis.yml 38install: 39- npm ci 40# keep the npm cache around to speed up installs 41cache: 42 directories: 43 - "$HOME/.npm" 44``` 45 46### Description 47 48This command is similar to [`npm install`](/cli-commands/npm-install), except it's meant to be used in 49automated environments such as test platforms, continuous integration, and 50deployment -- or any situation where you want to make sure you're doing a clean 51install of your dependencies. It can be significantly faster than a regular npm 52install by skipping certain user-oriented features. It is also more strict than 53a regular install, which can help catch errors or inconsistencies caused by the 54incrementally-installed local environments of most npm users. 55 56In short, the main differences between using `npm install` and `npm ci` are: 57 58* The project **must** have an existing `package-lock.json` or `npm-shrinkwrap.json`. 59* If dependencies in the package lock do not match those in `package.json`, `npm ci` will exit with an error, instead of updating the package lock. 60* `npm ci` can only install entire projects at a time: individual dependencies cannot be added with this command. 61* If a `node_modules` is already present, it will be automatically removed before `npm ci` begins its install. 62* It will never write to `package.json` or any of the package-locks: installs are essentially frozen. 63 64### See Also 65 66* [npm install](/cli-commands/npm-install) 67* [package-locks](/configuring-npm/package-locks) 68