registry.7 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. .TH "REGISTRY" "7" "August 2021" "" ""
  2. .SH "NAME"
  3. \fBregistry\fR \- The JavaScript Package Registry
  4. .SS Description
  5. .P
  6. To resolve packages by name and version, npm talks to a registry website
  7. that implements the CommonJS Package Registry specification for reading
  8. package info\.
  9. .P
  10. npm is configured to use npm, Inc\.'s public registry at
  11. https://registry\.npmjs\.org by default\. Use of the npm public registry is
  12. subject to terms of use available at https://www\.npmjs\.com/policies/terms\|\.
  13. .P
  14. You can configure npm to use any compatible registry you like, and even run
  15. your own registry\. Use of someone else's registry may be governed by their
  16. terms of use\.
  17. .P
  18. npm's package registry implementation supports several
  19. write APIs as well, to allow for publishing packages and managing user
  20. account information\.
  21. .P
  22. The npm public registry is powered by a CouchDB database,
  23. of which there is a public mirror at
  24. https://skimdb\.npmjs\.com/registry\|\. The code for the couchapp is
  25. available at https://github\.com/npm/npm\-registry\-couchapp\|\.
  26. .P
  27. The registry URL used is determined by the scope of the package (see
  28. npm help \fBscope\fP\|\. If no scope is specified, the default registry is used, which is
  29. supplied by the \fBregistry\fP config parameter\. See npm help \fBconfig\fP,
  30. npm help \fBnpmrc\fP, and npm help \fBconfig\fP for more on managing npm's configuration\.
  31. .SS Does npm send any information about me back to the registry?
  32. .P
  33. Yes\.
  34. .P
  35. When making requests of the registry npm adds two headers with information
  36. about your environment:
  37. .RS 0
  38. .IP \(bu 2
  39. \fBNpm\-Scope\fP – If your project is scoped, this header will contain its
  40. scope\. In the future npm hopes to build registry features that use this
  41. information to allow you to customize your experience for your
  42. organization\.
  43. .IP \(bu 2
  44. \fBNpm\-In\-CI\fP – Set to "true" if npm believes this install is running in a
  45. continuous integration environment, "false" otherwise\. This is detected by
  46. looking for the following environment variables: \fBCI\fP, \fBTDDIUM\fP,
  47. \fBJENKINS_URL\fP, \fBbamboo\.buildKey\fP\|\. If you'd like to learn more you may find
  48. the original PR \fIhttps://github\.com/npm/npm\-registry\-client/pull/129\fR
  49. interesting\.
  50. This is used to gather better metrics on how npm is used by humans, versus
  51. build farms\.
  52. .RE
  53. .P
  54. The npm registry does not try to correlate the information in these headers
  55. with any authenticated accounts that may be used in the same requests\.
  56. .SS Can I run my own private registry?
  57. .P
  58. Yes!
  59. .P
  60. The easiest way is to replicate the couch database, and use the same (or
  61. similar) design doc to implement the APIs\.
  62. .P
  63. If you set up continuous replication from the official CouchDB, and then
  64. set your internal CouchDB as the registry config, then you'll be able
  65. to read any published packages, in addition to your private ones, and by
  66. default will only publish internally\.
  67. .P
  68. If you then want to publish a package for the whole world to see, you can
  69. simply override the \fB\-\-registry\fP option for that \fBpublish\fP command\.
  70. .SS I don't want my package published in the official registry\. It's private\.
  71. .P
  72. Set \fB"private": true\fP in your package\.json to prevent it from being
  73. published at all, or
  74. \fB"publishConfig":{"registry":"http://my\-internal\-registry\.local"}\fP
  75. to force it to be published only to your internal registry\.
  76. .P
  77. See npm help \fBpackage\.json\fP for more info on what goes in the package\.json file\.
  78. .SS Will you replicate from my registry into the public one?
  79. .P
  80. No\. If you want things to be public, then publish them into the public
  81. registry using npm\. What little security there is would be for nought
  82. otherwise\.
  83. .SS Do I have to use couchdb to build a registry that npm can talk to?
  84. .P
  85. No, but it's way easier\. Basically, yes, you do, or you have to
  86. effectively implement the entire CouchDB API anyway\.
  87. .SS Is there a website or something to see package docs and such?
  88. .P
  89. Yes, head over to https://www\.npmjs\.com/
  90. .SS See also
  91. .RS 0
  92. .IP \(bu 2
  93. npm help config
  94. .IP \(bu 2
  95. npm help config
  96. .IP \(bu 2
  97. npm help npmrc
  98. .IP \(bu 2
  99. npm help developers
  100. .IP \(bu 2
  101. npm help disputes
  102. .RE