The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / deps / npm / html / doc / misc / npm-registry.html @ 5e865191

History | View | Annotate | Download (5.69 KB)

1
<!doctype html>
2
<html>
3
  <title>npm-registry</title>
4
  <meta http-equiv="content-type" value="text/html;utf-8">
5
  <link rel="stylesheet" type="text/css" href="../../static/style.css">
6

    
7
  <body>
8
    <div id="wrapper">
9
<h1><a href="../misc/npm-registry.html">npm-registry</a></h1> <p>The JavaScript Package Registry</p>
10

    
11
<h2 id="DESCRIPTION">DESCRIPTION</h2>
12

    
13
<p>To resolve packages by name and version, npm talks to a registry website
14
that implements the CommonJS Package Registry specification for reading
15
package info.</p>
16

    
17
<p>Additionally, npm&#39;s package registry implementation supports several
18
write APIs as well, to allow for publishing packages and managing user
19
account information.</p>
20

    
21
<p>The official public npm registry is at <a href="http://registry.npmjs.org/">http://registry.npmjs.org/</a>.  It
22
is powered by a CouchDB database at
23
<a href="http://isaacs.iriscouch.com/registry">http://isaacs.iriscouch.com/registry</a>.  The code for the couchapp is
24
available at <a href="http://github.com/isaacs/npmjs.org">http://github.com/isaacs/npmjs.org</a>.  npm user accounts
25
are CouchDB users, stored in the <a href="http://isaacs.iriscouch.com/_users">http://isaacs.iriscouch.com/_users</a>
26
database.</p>
27

    
28
<p>The registry URL is supplied by the <code>registry</code> config parameter.  See
29
<code><a href="../cli/npm-config.html">npm-config(1)</a></code>, <code><a href="../files/npmrc.html">npmrc(5)</a></code>, and <code><a href="../misc/npm-config.html">npm-config(7)</a></code> for more on managing
30
npm&#39;s configuration.</p>
31

    
32
<h2 id="Can-I-run-my-own-private-registry">Can I run my own private registry?</h2>
33

    
34
<p>Yes!</p>
35

    
36
<p>The easiest way is to replicate the couch database, and use the same (or
37
similar) design doc to implement the APIs.</p>
38

    
39
<p>If you set up continuous replication from the official CouchDB, and then
40
set your internal CouchDB as the registry config, then you&#39;ll be able
41
to read any published packages, in addition to your private ones, and by
42
default will only publish internally.  If you then want to publish a
43
package for the whole world to see, you can simply override the
44
<code>--registry</code> config for that command.</p>
45

    
46
<h2 id="I-don-t-want-my-package-published-in-the-official-registry-It-s-private">I don&#39;t want my package published in the official registry. It&#39;s private.</h2>
47

    
48
<p>Set <code>&quot;private&quot;: true</code> in your package.json to prevent it from being
49
published at all, or
50
<code>&quot;publishConfig&quot;:{&quot;registry&quot;:&quot;http://my-internal-registry.local&quot;}</code>
51
to force it to be published only to your internal registry.</p>
52

    
53
<p>See <code><a href="../files/package.json.html">package.json(5)</a></code> for more info on what goes in the package.json file.</p>
54

    
55
<h2 id="Will-you-replicate-from-my-registry-into-the-public-one">Will you replicate from my registry into the public one?</h2>
56

    
57
<p>No.  If you want things to be public, then publish them into the public
58
registry using npm.  What little security there is would be for nought
59
otherwise.</p>
60

    
61
<h2 id="Do-I-have-to-use-couchdb-to-build-a-registry-that-npm-can-talk-to">Do I have to use couchdb to build a registry that npm can talk to?</h2>
62

    
63
<p>No, but it&#39;s way easier.</p>
64

    
65
<h2 id="I-published-something-elsewhere-and-want-to-tell-the-npm-registry-about-it">I published something elsewhere, and want to tell the npm registry about it.</h2>
66

    
67
<p>That is supported, but not using the npm client.  You&#39;ll have to get
68
your hands dirty and do some HTTP.  The request looks something like
69
this:</p>
70

    
71
<pre><code>PUT /my-foreign-package
72
content-type:application/json
73
accept:application/json
74
authorization:Basic $base_64_encoded
75

    
76
{ &quot;name&quot;:&quot;my-foreign-package&quot;
77
, &quot;maintainers&quot;:[&quot;owner&quot;,&quot;usernames&quot;]
78
, &quot;description&quot;:&quot;A package that is hosted elsewhere&quot;
79
, &quot;keywords&quot;:[&quot;nih&quot;,&quot;my cheese smells the best&quot;]
80
, &quot;url&quot;:&quot;http://my-different-registry.com/blerg/my-local-package&quot;
81
}</code></pre>
82

    
83
<p>(Keywords and description are optional, but recommended.  Name,
84
maintainers, and url are required.)</p>
85

    
86
<p>Then, when a user tries to install &quot;my-foreign-package&quot;, it&#39;ll redirect
87
to your registry.  If that doesn&#39;t resolve to a valid package entry,
88
then it&#39;ll fail, so please make sure that you understand the spec, and
89
ask for help on the <a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com</a> mailing list.</p>
90

    
91
<h2 id="Is-there-a-website-or-something-to-see-package-docs-and-such">Is there a website or something to see package docs and such?</h2>
92

    
93
<p>Yes, head over to <a href="https://npmjs.org/">https://npmjs.org/</a></p>
94

    
95
<h2 id="SEE-ALSO">SEE ALSO</h2>
96

    
97
<ul><li><a href="../cli/npm-config.html">npm-config(1)</a></li><li><a href="../misc/npm-config.html">npm-config(7)</a></li><li><a href="../files/npmrc.html">npmrc(5)</a></li><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../misc/npm-disputes.html">npm-disputes(7)</a></li></ul>
98
</div>
99
<p id="footer">npm-registry &mdash; npm@1.3.4</p>
100
<script>
101
;(function () {
102
var wrapper = document.getElementById("wrapper")
103
var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
104
  .filter(function (el) {
105
    return el.parentNode === wrapper
106
        && el.tagName.match(/H[1-6]/)
107
        && el.id
108
  })
109
var l = 2
110
  , toc = document.createElement("ul")
111
toc.innerHTML = els.map(function (el) {
112
  var i = el.tagName.charAt(1)
113
    , out = ""
114
  while (i > l) {
115
    out += "<ul>"
116
    l ++
117
  }
118
  while (i < l) {
119
    out += "</ul>"
120
    l --
121
  }
122
  out += "<li><a href='#" + el.id + "'>" +
123
    ( el.innerText || el.text || el.innerHTML)
124
    + "</a>"
125
  return out
126
}).join("\n")
127
toc.id = "toc"
128
document.body.appendChild(toc)
129
})()
130
</script>