question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nexe does not automatically bundle dependencies

See original GitHub issue

Is 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
garbadoscommented, Jun 18, 2019

I hesitate to link the project’s dependencies but I will say yargs is in there:

$ cat package.json | jq .dependencies.yargs
"^12.0.5"
0reactions
vmarchaudcommented, Jul 4, 2019

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:

Error: Error: EACCES: permission denied, scandir '/lib/ssl/private'

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found