Pkg: FLAGS_MISMATCH when I run the packaged app.
It's most likely some misunderstanding on my side since I did not find any information of this by googling and searching the issues here.
Every time I run the packaged app, I got the warning:
"Pkg: FLAGS_MISMATCH"
I tried only using a index.js file with only the argv print operation.
process.argv.forEach(function(val, index, array) {
console.log(index + ': ' + val);
});
Run
pkg index.js -t macos
And run the packaged app, still the same result.
My node version: v10.7.0. pkg version is 4.3.3.
Ran into this when I added --options prof to the pkg command.
you may also check if there is NODE_OPTIONS environment variable set
@hshixun Thanks, will check that var next time.
Running into this over at https://github.com/lando/lando
We compile lando with pkg without settings any v8 options. If a user exports NODE_OPTIONS to anything (eg export NODE_OPTIONS=--max_old_space_size=4096) then tries to run lando it results in "Pkg: FLAGS_MISMATCH".
Is there a way to compile lando so that a user's NODE_OPTIONS is ignored if set to something mismatched?
Any update on this?
Seems like an enormous bug... anyone with the NODE_OPTIONS env var set cannot invoke executables compiled with pkg.
It also seems easy to fix. Can pkg simply clear the NODE_OPTIONS env var when invoking the bundled node at runtime? For reference, node itself complains about FLAGS_MISMATCH.
I'm keen for an update, too. Having to unset NODE_OPTIONS each time is getting real old!
This is breaking my balls as well.
Lol this is stupid. It seems to work if you compile it with options though e.g.
pkg . --options max_old_space_size=4096
It really doesn't seem like the solution should be to set every possible option in pkg. Do we know a list of options which are being set?
Is there some reason the current environment can't be detected and override whatever pkg defaults to?
Revising my initial suggestion, could the bundled binary simply invoke node with the options provided by the host's NODE_OPTIONS env var?
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
Anyone with the NODE_OPTIONS env var set cannot invoke executables compiled with pkg.
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.
With latest Node 16, the binary built with pkg exits immediately. We have no warning "Pkg: FLAGS_MISMATCH".
strace ./my_pkg_program ends with:
rt_sigprocmask(SIG_UNBLOCK, [TTOU], NULL, 8) = 0
exit_group(4) = ?
+++ exited with 4 +++
It works if you unset NODE_OPTIONS env:
NODE_OPTIONS="" ./my_pkg_program
I leave this comment mainly to help users to find the solution, hoping search engines will guide them here 🙂.
Can someone with pkg experience help us understand:
Is this an easy fix? i.e. can pkg simply pass NODE_OPTIONS="" into node?
With latest Node 16, the binary built with pkg exits immediately. We have no warning "Pkg: FLAGS_MISMATCH".
strace ./my_pkg_programends with:rt_sigprocmask(SIG_UNBLOCK, [TTOU], NULL, 8) = 0 exit_group(4) = ? +++ exited with 4 +++It works if you unset NODE_OPTIONS env:
NODE_OPTIONS="" ./my_pkg_programI leave this comment mainly to help users to find the solution, hoping search engines will guide them here 🙂.
I spent like 5ish hours today trying to figure this out and I'm glad you all verified I'm not crazy haha. My goal was to dynamically set the heap size based on some bash-fu aimed at exporting NODE_OPTIONS.
@jchook thanks for keeping this alive, maybe there's a fix by now 🤞 haha.
@marquiswashere maybe open another ticket to get their attention.
This seems to me like it should be easy to fix.