Skip to content
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

shelljs.exec cannot find app.asar/node_modules/shelljs/src/exec-child.js #881

davidv1992 opened this issue Jul 24, 2018 · 3 comments
electron Bugs specific to the electron framework


Copy link

davidv1992 commented Jul 24, 2018

Node version (or tell us if you're using electron or some other framework):

electron 1.8.6 prebuilt from electron-builder

ShellJS version (the most recent version/Github branch you see the bug on):

shelljs 0.8.2

Operating system:

ubuntu 18.04

Description of the bug:

I am building an electron app using shelljs, and after packaging with electron-builder, using shelljs.exec fails, returning null and printing the following stacktrace on the console:

Error: Cannot find module '/redacted/dist/linux-unpacked/resources/app.asar/node_modules/shelljs/src/exec-child.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

Example ShellJS command to reproduce the error:

exec(`find /bin /usr/bin /usr/local/bin -executable -name 'thunderbird' \\( -type f -or -type l \\)`)
@nfischer nfischer added the electron Bugs specific to the electron framework label Jul 24, 2018
Copy link

This specific message is unexpected. exec-child.js is a file we ship (you can see it in this repository). Can you check if this file exists anywhere in your node_modules/ folder?

$ find node_modules/ -name exec-child.js

That being said, we have never supported electron. We list some known issues with possible workarounds. If there's an obvious fix for an electron-related issue, we're happy to consider it, but maintenance has only been best-effort, not guaranteed.

Copy link

Figured out the issue. Because of the workaround you listed, it is using the system node.js, which doesnt know about asar archives. I am fixing this by migrating back to nodes native child_process.exec/execSync

Copy link

I see. In this case, this is likely not fixable in shell.exec(), but I believe this will be fixed in #866 (this does not rely on spawning something with the path to the node binary).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
electron Bugs specific to the electron framework
None yet

No branches or pull requests

2 participants