You can clone with
When I npm link a package with a dependency that I have installed via npm link or a tarball, that isn't in the npm registry, npm fails.
Seems like npm link will npm install itself post link, to handle dependencies. And npm install doesn't seem to check if a dependency of a package is already installed before querying the registry. So that's the only fix needed it seems.
Update 2:targetResolver in npm install only checks for existing installs in node_modules of the package from where npm link is executed. As seen below, this means it won't find packages that has been linked, since linking installs to ~/local/node/lib/node_modules.
So a sensible fix as far as I know would be to have targetResolver do a full scale check - i.e. NODE_PATH and node_modules in all parent directories.
Piggybacking on require.resolve is probably not a good idea, as some packages might only have a bin/ for example, and is not requireable.
$> cd ~/package-foo
../local/node/lib/node_modules/package-foo -> /home/augustl/package-foo
$> cd ~/package-bar
$> npm link
npm ERR! 404 'package-foo' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it.
npm ERR! 404 Note that you can also install from a tarball or folder.
npm ERR! System Linux 2.6.39-ARCH
npm ERR! command "node" "/home/augustl/local/node/bin/npm" "link"
npm ERR! cwd /home/augustl/sandbox/package-bar
npm ERR! node -v v0.4.8
npm ERR! npm -v 1.0.20
npm ERR! Additional logging details can be found in:
npm ERR! /home/augustl/package-bar/npm-debug.log
npm not ok
+1. This is similar to the issue I raised in #1024. I have worked around this by commenting out the dependencies in the packages that I want to link... but this isn't ideal.
Thanks for the workaround, sounds like a sensible temporary "fix".
+1 This keeps me from using npm offline.
In general, I'd like to be able to make the following guarantees:
Reproduction for #1182