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