1NPM-CI(1)                                                            NPM-CI(1)
2
3
4

NAME

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