Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set v8 options in node.js

Tags:

node.js

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?

like image 362
crickeys Avatar asked Jan 12 '12 02:01

crickeys


People also ask

Does Nodejs use V8?

The core powering Node. js is this V8 engine. The diagram shows a comparison with the Java Virtual Machine (JVM), which power the Java Runtime environment.

How V8 engine works in Nodejs?

V8 is known to be a JavaScript engine because it takes JavaScript code and executes it while browsing in Chrome. It provides a runtime environment for the execution of JavaScript code. The best part is that the JavaScript engine is completely independent of the browser in which it runs.

What are the command line options in Node JS?

There is a wide variety of command line options in Node.js. These options provide multiple ways to execute scripts and other helpful run-time options. Let's see the list of Node.js command line options: Index. Option. Description. 1. v, --version. It is used to print node's version.

How to enable V8 engine behavior in Node JS?

Node.js can be invoked with an incredibly various set of options. Most of those options are used to configure the v8 engine behavior. Some of the options here are disabled by default, as you cna see in the Default column. You can enable them by running node and passing the flag, for example node --experimental-extras.

What is the best way to run Node JS?

nvm is a popular way to run Node.js. It allows you to easily switch the Node.js version, and install new versions to try and easily rollback if something breaks. It is also very useful to test your code with old Node.js versions.

What are the node node configuration options?

Node has a number of runtime configuration options, and they have 3 ways of being specified: 1 compiled-in configuration 2 environment variables 3 command line options


1 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
like image 72
nimrodm Avatar answered Oct 19 '22 17:10

nimrodm