event-loop-stats
event-loop-stats copied to clipboard
Add node-gyp to dependencies
Recently npm
has stopped bundling the node-gyp-bin
directory (https://github.com/npm/cli/pull/6554). But yarn classic uses this location to find npm's bundled node-gyp. Yarn detects that event-loop-stats
uses node-gyp in its lifecycle script but does not specify it as a dependency, so it tries to ensure that node-gyp is installed. As it can't find the npm's bundled one, it instead tries to install it globally into its own store (equivalent to yarn global add node-gyp
). But this triggers a yarn bug (https://github.com/yarnpkg/yarn/issues/3728), where it doesn't then proceed with the rest of the installation correctly and doesn't generate a yarn.lock and in fact run lifecycle scripts on our own package (prepare
, postinstall
).
On second thought, I'm not sure this is the right approach, as node-gyp and its 27MiB of dependencies will be transitively present in users' node_modules. It does seem to be the recommended approach by yarn, though.
Thank you for the PR @sammko. TBH I haven't followed the state of things node-gyp related and I am therefore unaware of changed best practices. Given my lack of additional insight, I would therefore keep this PR open until additional insight (in the form of comments/articles) emerges. I hope you understand.