Closed sam-github closed 8 years ago
This is the root of the bug:
https://github.com/rxaviers/cldr-data-npm/blob/master/install.js#L20 is assuming a very specific npm package layout, a layout that isn't guaranteed by npm@2 under all conditions, and is not how npm@3 installs packages, it flattens them.
Personally, I don't think the problems of this check out-weigh any benefits. I'd fix it, but I'm not actually sure how that would be done. Its not clear that npm allows a package to know "why" it was installed, and I believe all attempts to determine this will run afoul of npm's install/package layout algorithm in at least some corner cases.
I just hit this as well. Very annoying. Solution would be to just throw out the check for peer dependency.
It has three problems:
0
: https://github.com/rxaviers/cldr-data-npm/blob/master/install.js#L52, this is incorrect. Failing scripts must exit with a non-0
status to indicate failure.Our scenario is this:
This is all correct. cldr-data is installed via direct dependency, NOT via the globalize peerDependency, but cldr-data doesn't download, and after printing a message, reports success via its exit status.
cldr-data's gets installed by npm3 at the top-level, using the flattening, and this appears to confuse the script.