npm - npm3 does not flatten a dependency structure completely -
npm3 brought use dependencies flattening node_modules folder flat. apparently that's not true. have application, let's name a , module i'm developing, b. module has gulp dependency , gulp plugins, gulp-rename. expecting have gulp , gulp-rename in node-modules folder of app a (as has b dependency). not case. gulp-rename in fact in a/node_modules gulp in a/node_modules/b/node_modules folder.
any clues why happening?
update
i've narrowed down issue particular case:
having app a , module i'm developing, b. module has gulp dependency , package.json bin property defined following (b's package.json):
javascript "bin" { "gulp": "<some_valid_path>" }
i expecting have gulp in node-modules folder of app a (as has b dependency , because of npm3 dependency flattening). apparently npm leaves in a/node_modules/b/node_modules folder. intended behaviour , why?
well, npm flattens dependency tree as possible; not mean it's entirely flat. example, if dependency d1 depends on ^1.0.0 , d2 depends on ^2.0.0, npm cannot put both these dependencies root node_modules simultaneously. 1 version of (say 1.0.0) may go root, other must go node_modules/d2/node_modules such d2 finds in correct version before starts looking in parent dir.
Comments
Post a Comment