1NPM-CI(1) NPM-CI(1)
2
3
4
6 npm-ci - Install a project with a clean slate
7
8 Synopsis
9 npm ci
10
11 Description
12 This command is similar to npm help install, except it's meant to be
13 used in automated environments such as test platforms, continuous inte‐
14 gration, and deployment -- or any situation where you want to make sure
15 you're doing a clean install of your dependencies.
16
17 npm ci will be significantly faster when:
18
19 • There is a package-lock.json or npm-shrinkwrap.json file.
20
21 • The node_modules folder is missing or empty.
22
23
24 In short, the main differences between using npm install and npm ci
25 are:
26
27 • The project must have an existing package-lock.json or
28 npm-shrinkwrap.json.
29
30 • If dependencies in the package lock do not match those in pack‐
31 age.json, npm ci will exit with an error, instead of updating the
32 package lock.
33
34 • npm ci can only install entire projects at a time: individual depen‐
35 dencies cannot be added with this command.
36
37 • If a node_modules is already present, it will be automatically re‐
38 moved before npm ci begins its install.
39
40 • It will never write to package.json or any of the package-locks: in‐
41 stalls are essentially frozen.
42
43
44 Example
45 Make sure you have a package-lock and an up-to-date install:
46
47 $ cd ./my/npm/project
48 $ npm install
49 added 154 packages in 10s
50 $ ls | grep package-lock
51
52 Run npm ci in that project
53
54 $ npm ci
55 added 154 packages in 5s
56
57 Configure Travis to build using npm ci instead of npm install:
58
59 # .travis.yml
60 install:
61 - npm ci
62 # keep the npm cache around to speed up installs
63 cache:
64 directories:
65 - "$HOME/.npm"
66
67 Configuration
68 <!-- AUTOGENERATED CONFIG DESCRIPTIONS START --> <!-- automatically
69 generated, do not edit manually --> <!-- see lib/utils/config/defini‐
70 tions.js -->
71
72 audit
73 • Default: true
74
75 • Type: Boolean
76
77
78 When "true" submit audit reports alongside the current npm command to
79 the default registry and all registries configured for scopes. See the
80 documentation for npm help audit for details on what is submitted.
81 <!-- automatically generated, do not edit manually --> <!-- see
82 lib/utils/config/definitions.js -->
83
84
85 ignore-scripts
86 • Default: false
87
88 • Type: Boolean
89
90
91 If true, npm does not run scripts specified in package.json files.
92
93 Note that commands explicitly intended to run a particular script, such
94 as npm start, npm stop, npm restart, npm test, and npm run-script will
95 still run their intended script if ignore-scripts is set, but they will
96 not run any pre- or post-scripts. <!-- automatically generated, do not
97 edit manually --> <!-- see lib/utils/config/definitions.js -->
98
99
100 script-shell
101 • Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
102
103 • Type: null or String
104
105
106 The shell to use for scripts run with the npm exec, npm run and npm
107 init <pkg> commands. <!-- automatically generated, do not edit manu‐
108 ally --> <!-- see lib/utils/config/definitions.js -->
109
110 <!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
111
112
113 See Also
114 • npm help install
115
116 • npm help package-lock.json
117
118
119
120
121 January 2022 NPM-CI(1)