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

Fix "Error spawn ENOENT" when package using "pkg" #56

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lupohan44
Copy link

When using "pkg" to package it into binary file, we will get "Error spawn ENOENT" like vercel/pkg#342

This commit copy 7zip to a temperary folder and execute the 7zip from there to avoid this issue

@onikienko
Copy link
Owner

Thank you for PR @lupohan44

I've never used vercel/pkg. But this fix looks like a workaround. Is there a way to copy 7zip to the temp folder only if it is pkg? Otherwise, use the current implementation?

@lupohan44
Copy link
Author

lupohan44 commented Jun 12, 2022 via email

@onikienko
Copy link
Owner

Hi @lupohan44
Thank you for the updates. Meanwhile reading the issue you have mentioned I noticed this comment vercel/pkg#342 (comment)

As I understand you can't use fs.copyFileSync too. But have to read assets into memory then write them into disk .
Did you test your code with pkg?

@lupohan44
Copy link
Author

lupohan44 commented Jun 14, 2022 via email

@onikienko
Copy link
Owner

I see. Interesting. Will try to check my own.
For now, I opened issue #57 for that error.
Thank you for your contributions @lupohan44

@Jazcash
Copy link

Jazcash commented Aug 28, 2022

I'm getting this same error in my electron app:

Error: spawn C:\Users\jaz\Repos\bar-lobby\node_modules\electron\dist\resources\electron.asar\renderer\win\x64\7za.exe ENOENT

@lupohan44
Copy link
Author

I'm getting this same error in my electron app:

Error: spawn C:\Users\jaz\Repos\bar-lobby\node_modules\electron\dist\resources\electron.asar\renderer\win\x64\7za.exe ENOENT

You can apply this patch into your project manually, it should fix your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants