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">
9 <h1><a href="../cli/npm-link.html">npm-link</a></h1> <p>Symlink a package folder</p>
11 <h2 id="SYNOPSIS">SYNOPSIS</h2>
13 <pre><code>npm link (in package folder)
14 npm link <pkgname></code></pre>
16 <h2 id="DESCRIPTION">DESCRIPTION</h2>
18 <p>Package linking is a two-step process.</p>
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>
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>
26 <p>Note that <code>package-name</code> is taken from <code>package.json</code> ,
27 not from directory name.</p>
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>
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>
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>
43 <p>Now, any changes to ~/projects/node-redis will be reflected in
44 ~/projects/node-bloggy/node_modules/redis/</p>
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>
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>
52 <p>The second line is the equivalent of doing:</p>
54 <pre><code>(cd ../node-redis; npm link)
55 npm link redis</code></pre>
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>
60 <h2 id="SEE-ALSO">SEE ALSO</h2>
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>
64 <p id="footer">npm-link — npm@1.3.3</p>
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]/)
75 , toc = document.createElement("ul")
76 toc.innerHTML = els.map(function (el) {
77 var i = el.tagName.charAt(1)
87 out += "<li><a href='#" + el.id + "'>" +
88 ( el.innerText || el.text || el.innerHTML)
93 document.body.appendChild(toc)