Home » Nodejs » How do I set v8 options in node.js

How do I set v8 options in node.js

Posted by: admin November 29, 2017 Leave a comment

Questions:

For example, I want to disable the new heap snapshots so I type something like this:

node --new_snapshot=false

But I get an error: Error: illegal value for flag –new_snapshot=false of type bool

What am I missing about the syntax?

Answers:

I had to dig into v8 source code to get this. For some reason I couldn’t find it documented. However, a boolean option is enabled by setting --option and disabled by using --nooption (note the no prefix).

So in your case use

node --nonew_snapshot

Questions:
Answers:

I bumped into this while I was looking for something else and this is a better way to find out what is available in v8 on node.js. You can get the options by running the following command.

node –v8-options