feross / zelda

Automatically `npm link` all your packages together!
MIT License
283 stars 32 forks source link

Fails when dependent linked modules are not published #18

Closed alasdairhurst closed 7 years ago

alasdairhurst commented 7 years ago

In my use case I'm actively developing module x which is a dependency of A. The current branch of A depends on a version of x which is not published. When i git clone A, then cd A and run zelda, it just tries to npm install, which fails since the registry cannot find the version of x that it depends on which is cloned and currently in development,

> git clone A
> git clone x
> cd A
> zelda
[zelda] npm install A
npm ERR! 
...
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/x
...
[zelda] Found 0 local packages for A

Shouldn't this run npm link on any found dependencies BEFORE npm install takes place?

feross commented 7 years ago

We don't actually run npm link. Instead we create a symlink in your code folder called node_modules that points up one directory to the code folder. This simple solution means that the Node.js module resolution algorithm will find your code. Node.js just searches all node_modules/ folders up to the root of the system until it finds a folder inside that matches the module name being required.

So, in short, there's not a way we can run npm link first. To use zelda, don't depend on non-existent versions of modules. Or temporarily change the version before running zelda.