-
Notifications
You must be signed in to change notification settings - Fork 1k
Error: Command failed: Executing pkg cli from the child process of pkg cli getting failed. #897
Comments
As a first step towards solving your issue, please switch to using |
Have you had any luck with this issue? I think I am running into the same problem. |
Having exactly the same issue (same stack trace); @igorklopov what are you suggesting? If I want my pkg'd app to I've tried these and they both throw
I've been able to solve my specific use-case by spawning a local module within my package where I've put the functionality:
But the main issue remains; I think I should be able to spawn the app itself with args. Is this supported? |
I am running into the same problem, any news? |
I had the same issue, and find some interesting behavior that is not documented for pkg - when you calling packed executable from outside, manually, it acts like if you call node with second argument set to internal main script ( /snapshot/project/main.js ). You can check it with |
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label |
This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit. |
I don't think this issue is solved. I am trying to bundle pnpm with pkg and getting this errors when there are |
Just chiming to say we're seeing the same issue in a tool we're building. Here's the relevant bug report. Has anyone found a workaround to this? |
I did this fork for pnpm with a few changes: https://github.com/zoli-forks/pkg It seems to work fine for us. |
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This works around vercel/pkg#897 by patching the `pkg` `prelude/bootstrap.js` script. Fixes #2032
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label |
This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit. |
@zkochan Would you mind to submit a PR? |
I also ran into this issue, but specifically because I consider global mutation bad behavior that introduces unexpected side-effects to userland. Is this absolutely necessary? Can we at least have an opt-out? Happy to PR if you'd like to provide some guidance! |
I think it could be opted out using an env var? @jesec |
I'd be fine with an env var or cli flag, whatever works for y'all. |
Just checking back again: would a PR be welcome? |
I have an open pull request that fixes this issue: #1344 |
FYI, the way we've solved this for ourselves is this patch, applied with https://www.npmjs.com/package/patch-package:
And setting |
It looks like Lines 1851 to 1980 in 2ef4cd9
Line 1874 in 2ef4cd9
|
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label |
bump |
There are basically two camps of users. One camp wants a pkg-generated executable to behave as the bundled application in all scenarios. The other camp wants the executable to behave as the Node.js runtime when they want it to. It is very tricky to support both cases, and I am considering to declare that "the pkg-generated executable can't be used as Node.js runtime" in the next major release. |
This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label |
This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit. |
Hello, I am having this same issue Line 2010 in bb04269
So, in my understanding, it seems that this logic (where I am seeing the problem) is only true when we call the binary from the same binary using the Lines 77 to 84 in bb04269
But if I comment the above logic (that is a very similar approach @edvald mentioned here) it starts to work. in which other case is the above logic called? this is to understand if the validation could be improved in some way or what could I lose if I comment that logic just for my case. |
Hi all 👋 Any update about this one? |
We have a requirement to call the shell script from pkg CLI and that script is again calling the same pkg CLI.
Our CLI is calling the shell script using the child_process package of the node. In a shell script, we are again calling the Pkg CLI if some condition is met.
Following is the testing Code: test.js
Created binary using
pkg test.js -t 'node12-macos-x64' -o 'pkgBinary'
after the execution of command './pkgBinary 1'. I am getting the following error.
Error: Command failed: ./pkgBinary 2
internal/modules/cjs/loader.js:983
throw err;
^
Error: Cannot find module '/Users/appirio-13532/practice/2'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1346:46)
at Function.Module._load (internal/modules/cjs/loader.js:862:27)
at Function.Module.runMain (pkg/prelude/bootstrap.js:1375:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
status: 1,
signal: null,
output: [
null,
,
<Buffer 69 6e 74 65 72 6e 61 6c 2f 6d 6f 64 75 6c 65 73 2f 63 6a 73 2f 6c 6f 61 64 65 72 2e 6a 73 3a 39 38 33 0a 20 20 74 68 72 6f 77 20 65 72 72 3b 0a 20 20 ... 450 more bytes>
],
pid: 14642,
stdout: ,
stderr: <Buffer 69 6e 74 65 72 6e 61 6c 2f 6d 6f 64 75 6c 65 73 2f 63 6a 73 2f 6c 6f 61 64 65 72 2e 6a 73 3a 39 38 33 0a 20 20 74 68 72 6f 77 20 65 72 72 3b 0a 20 20 ... 450 more bytes>
}
The text was updated successfully, but these errors were encountered: