npm-ci.1 3.5 KB

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