-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to bundle npm
as a dependency: Cannot find module 'node-gyp/bin/node-gyp'
#275
Comments
npm
as a dependency due to node gypnpm
as a dependency: Cannot find module 'node-gyp/bin/node-gyp'
I also have a branch called npm-commands in the same repo that gets a different error:
|
I just tried this out and get a very different error:
It says Success right!? Are you sure you are using ncc 15? We can certainly try to continue working on this though. |
@guybedford The build works fine. It's when you try to run the output file is when it fails. Notice the last step in the repro steps above is I just tested again with ncc 15 and its the same error. I should be more clear: this is a runtime bug, not a compile time bug. |
@styfle ok this is because the code that loads node-gyp is the following: const DEFAULT_NODE_GYP_PATH = resolveFrom(__dirname + '/npm-lifecycle', 'node-gyp/bin/node-gyp') where const resolveFileName = () => Module._resolveFilename(moduleId, {
id: fromFile,
filename: fromFile,
paths: Module._nodeModulePaths(fromDir)
}); so the static analysis just doesn't reach this level unfortunately. The best thing to do here would be to inline the actual Note that you can mimic this already by just ensuring that |
I can't seem to bundle
npm
as a runtime dependency.This is necessary to get Package Phobia on Now 2.0.
Steps to reproduce
git clone https://github.com/styfle/ncc-bug-npm cd ncc-bug-npm ncc build index.js node dist/index.js
Error output
The text was updated successfully, but these errors were encountered: