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

--optimize_for_size flag doesn't work with NODE_OPTIONS env (windows 10) #35440

Closed
crutch12 opened this issue Oct 1, 2020 · 4 comments
Closed
Labels
cli Issues and PRs related to the Node.js command line interface.

Comments

@crutch12
Copy link

crutch12 commented Oct 1, 2020

  • Version: v12.16.1
  • Platform: windows 10
  • Subsystem:

What steps will reproduce the bug?

Run

# I use cross-env, you can use any tool for env setting
$ cross-env NODE_OPTIONS='--optimize_for_size' node

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

It has to work just like this:

$ node --optimize_for_size
...
Welcome to Node.js v12.16.1.
Type ".help" for more information.

What do you see instead?

$ cross-env NODE_OPTIONS='--optimize_for_size' node

Error:

node: --optimize_for_size is not allowed in NODE_OPTIONS

Additional information

Another flags work correctly, for example:

$ cross-env NODE_OPTIONS='--preserve-symlinks --max_old_space_size=4096' node

I've checked source code and found out that --optimize_for_size flag is not added (using AddOption function) in node_options.cc file:

PerIsolateOptionsParser::PerIsolateOptionsParser(


UPD:
This option is not allowed for NODE_OPTIONS env: https://nodejs.org/api/cli.html#cli_node_options_options

@himself65 himself65 added the cli Issues and PRs related to the Node.js command line interface. label Oct 1, 2020
@crutch12
Copy link
Author

crutch12 commented Oct 2, 2020

My fault, this option is not allowed for NODE_OPTIONS env:
https://nodejs.org/api/cli.html#cli_node_options_options

So another question - why does --optimize_for_size is not available to pass with NODE_OPTIONS?

@drandell
Copy link

drandell commented Oct 25, 2021

In a similar vein, why is --gc_interval not available to pass with NODE_OPTIONS?

@tkrah
Copy link

tkrah commented Feb 3, 2022

Btw, that is not only a windows 10 problem like the subject may imply, same does apply e.g. to linux environments. I would really tune those node_options to meet my CI requirements - resources have to be shared there.
So why are those options not passed - the doc just state which are passed but takes no reason to elaborate why others are not - at least I did not found it ;).

The docs also has this https://nodejs.org/api/cli.html#useful-v8-options:

V8 has its own set of CLI options. Any V8 CLI option that is provided to node will be passed on to V8 to handle.

So any option will be passed according to the docs - but this is obviously not the case.

@huseyinacacak-janea
Copy link
Contributor

Hi @crutch12, as you updated the issue description, --optimize_for_size is not allowed for NODE_OPTIONS. Do you think this can be closed now?

@RedYetiDev RedYetiDev closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Issues and PRs related to the Node.js command line interface.
Projects
None yet
Development

No branches or pull requests

6 participants