Nexe does not automatically bundle dependencies
See original GitHub issueIs this a BUG or a FEATURE REQUEST?:
Bug 🐛 🪲 🐝
What happened:
The produced binaries fail to run unless the entirety of node_modules/
is bundled with them. If node_modules/
is moved or removed, the binary complains that it cannot find necessary modules.
$ npm i
$ npx nexe -i ./bin/agent -t static-x64-10.15.0 -o build/agent -r lib/
$ rm -rf node_modules/
$ ./build/agent --help
Error: Cannot find module 'yargs'
The workaround, to specify -r node_modules/
doubles the size of the resulting executables, creating 100MB binaries from 29KB of source code.
What you expected to happen:
I expect Nexe to resolve require
calls during compilation, and not to fail for want of dependencies after the fact.
How to reproduce it (as minimally and precisely as possible):
See the above code sample.
Anything else we need to know?:
Environment
- Platform(OS/Version): Ubuntu 18.04
- Host Node Version: v10.7.0
- Target Node Version: v10.15.0
- Nexe version: v3.3.1
- Python Version: 2.7.15+ / 3.7.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:17 (7 by maintainers)
Top Results From Across the Web
nexe-natives-fix - npm Package Health Analysis - Snyk
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF...
Read more >caxa - npm
Not only are native dependencies different on the operating systems, but they may also be different between different versions of Node.js if ...
Read more >How to create an executable (.exe) file from JavaScript code ...
JavaScript doesn't even have a compiler so how do we even fathom the ... code (along with dependencies such as .js files or...
Read more >One little deno feature I didn't realize until digging in to play ...
Static linking does not bundle the entire library into a binary. ... my belief is many regions (including the code) are not automatically...
Read more >Nexe issue #607 appears to be fixed; refactor accordingly (#225 ...
copyFileSync does not work for resources bundled in binaries appears to be ... https://source.small-tech.org/site.js/lib/auto-encrypt-localhost/-/blob/ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I hesitate to link the project’s dependencies but I will say yargs is in there:
I’ve got the same issue using the last version, switching to a
.js
extension doesn’t fix the issue for me through, i get the following error:I understand that the module
resolve-dependencies
is looking for them on the FS but why is it going on the root of my FS ? Do you have an idea @calebboyd ? Thanks for your help