Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Pkg: FLAGS_MISMATCH when I run the packaged app. #484

Closed
liweiz opened this issue Jul 30, 2018 · 18 comments
Closed

Pkg: FLAGS_MISMATCH when I run the packaged app. #484

liweiz opened this issue Jul 30, 2018 · 18 comments
Labels

Comments

@liweiz
Copy link

liweiz commented Jul 30, 2018

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.

@markus456
Copy link

Ran into this when I added --options prof to the pkg command.

@hshixun
Copy link

hshixun commented Sep 7, 2018

you may also check if there is NODE_OPTIONS environment variable set

@liweiz
Copy link
Author

liweiz commented Sep 9, 2018

@hshixun Thanks, will check that var next time.

@pirog
Copy link

pirog commented May 9, 2019

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?

@jchook
Copy link

jchook commented Sep 29, 2019

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.

@azzamaurice
Copy link

I'm keen for an update, too. Having to unset NODE_OPTIONS each time is getting real old!

@soniktrooth
Copy link

This is breaking my balls as well.

@ayroblu
Copy link

ayroblu commented May 3, 2020

Lol this is stupid. It seems to work if you compile it with options though e.g.

pkg . --options max_old_space_size=4096

@MGibson1
Copy link

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?

@jchook
Copy link

jchook commented Mar 12, 2021

Revising my initial suggestion, could the bundled binary simply invoke node with the options provided by the host's NODE_OPTIONS env var?

@github-actions
Copy link

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

@github-actions github-actions bot added the Stale label Jun 11, 2021
@jchook
Copy link

jchook commented Jun 11, 2021

Anyone with the NODE_OPTIONS env var set cannot invoke executables compiled with pkg.

@github-actions github-actions bot removed the Stale label Jun 12, 2021
@github-actions
Copy link

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

@github-actions github-actions bot added the Stale label Sep 10, 2021
@github-actions
Copy link

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

@dgrelaud
Copy link

dgrelaud commented Nov 17, 2021

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 🙂.

@jchook
Copy link

jchook commented Nov 17, 2021

Can someone with pkg experience help us understand:

Is this an easy fix? i.e. can pkg simply pass NODE_OPTIONS="" into node?

@marquiswashere
Copy link

marquiswashere commented Jan 7, 2022

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 🙂.

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.

@jchook
Copy link

jchook commented Jan 7, 2022

@marquiswashere maybe open another ticket to get their attention.

This seems to me like it should be easy to fix.

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

No branches or pull requests