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.
main_repo / deps / npm / html / doc / cli / npm-link.html @ 5e865191
History | View | Annotate | Download (3.37 KB)
1 |
<!doctype html>
|
---|---|
2 |
<html>
|
3 |
<title>npm-link</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="../cli/npm-link.html">npm-link</a></h1> <p>Symlink a package folder</p> |
10 |
|
11 |
<h2 id="SYNOPSIS">SYNOPSIS</h2> |
12 |
|
13 |
<pre><code>npm link (in package folder) |
14 |
npm link <pkgname></code></pre> |
15 |
|
16 |
<h2 id="DESCRIPTION">DESCRIPTION</h2> |
17 |
|
18 |
<p>Package linking is a two-step process.</p> |
19 |
|
20 |
<p>First, <code>npm link</code> in a package folder will create a globally-installed |
21 |
symbolic link from <code>prefix/package-name</code> to the current folder.</p> |
22 |
|
23 |
<p>Next, in some other location, <code>npm link package-name</code> will create a |
24 |
symlink from the local <code>node_modules</code> folder to the global symlink.</p> |
25 |
|
26 |
<p>Note that <code>package-name</code> is taken from <code>package.json</code> , |
27 |
not from directory name.</p>
|
28 |
|
29 |
<p>When creating tarballs for <code>npm publish</code>, the linked packages are |
30 |
"snapshotted" to their current state by resolving the symbolic links.</p> |
31 |
|
32 |
<p>This is
|
33 |
handy for installing your own stuff, so that you can work on it and test it |
34 |
iteratively without having to continually rebuild.</p>
|
35 |
|
36 |
<p>For example:</p> |
37 |
|
38 |
<pre><code>cd ~/projects/node-redis # go into the package directory |
39 |
npm link # creates global link |
40 |
cd ~/projects/node-bloggy # go into some other package directory. |
41 |
npm link redis # link-install the package</code></pre> |
42 |
|
43 |
<p>Now, any changes to ~/projects/node-redis will be reflected in
|
44 |
~/projects/node-bloggy/node_modules/redis/</p>
|
45 |
|
46 |
<p>You may also shortcut the two steps in one. For example, to do the
|
47 |
above use-case in a shorter way:</p>
|
48 |
|
49 |
<pre><code>cd ~/projects/node-bloggy # go into the dir of your main project |
50 |
npm link ../node-redis # link the dir of your dependency</code></pre> |
51 |
|
52 |
<p>The second line is the equivalent of doing:</p> |
53 |
|
54 |
<pre><code>(cd ../node-redis; npm link) |
55 |
npm link redis</code></pre> |
56 |
|
57 |
<p>That is, it first creates a global link, and then links the global
|
58 |
installation target into your project's <code>node_modules</code> folder.</p> |
59 |
|
60 |
<h2 id="SEE-ALSO">SEE ALSO</h2> |
61 |
|
62 |
<ul><li><a href="../misc/npm-developers.html">npm-developers(7)</a></li><li><a href="../misc/npm-faq.html">npm-faq(7)</a></li><li><a href="../files/package.json.html">package.json(5)</a></li><li><a href="../cli/npm-install.html">npm-install(1)</a></li><li><a href="../misc/npm-folders.html">npm-folders(7)</a></li><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></ul> |
63 |
</div>
|
64 |
<p id="footer">npm-link — npm@1.3.4</p> |
65 |
<script>
|
66 |
;(function () {
|
67 |
var wrapper = document.getElementById("wrapper")
|
68 |
var els = Array.prototype.slice.call(wrapper.getElementsByTagName("*"), 0)
|
69 |
.filter(function (el) {
|
70 |
return el.parentNode === wrapper
|
71 |
&& el.tagName.match(/H[1-6]/)
|
72 |
&& el.id
|
73 |
})
|
74 |
var l = 2
|
75 |
, toc = document.createElement("ul")
|
76 |
toc.innerHTML = els.map(function (el) {
|
77 |
var i = el.tagName.charAt(1)
|
78 |
, out = ""
|
79 |
while (i > l) {
|
80 |
out += "<ul>"
|
81 |
l ++
|
82 |
}
|
83 |
while (i < l) {
|
84 |
out += "</ul>"
|
85 |
l --
|
86 |
}
|
87 |
out += "<li><a href='#" + el.id + "'>" +
|
88 |
( el.innerText || el.text || el.innerHTML)
|
89 |
+ "</a>"
|
90 |
return out
|
91 |
}).join("\n")
|
92 |
toc.id = "toc"
|
93 |
document.body.appendChild(toc)
|
94 |
})()
|
95 |
</script>
|