42

I want to know which javascript version is my NodeJS is supporting ?

1
  • 5
    Almost 10 years later, have you found any good method to achieve this? Commented Feb 26, 2021 at 16:01

5 Answers 5

26

Use process.versions. From that page in the documentation:

console.log(process.versions);

outputs

{ node: '0.4.12',
  v8: '3.1.8.26',
  ares: '1.7.4',
  ev: '4.4',
  openssl: '1.0.0e-fips' }

EDIT: V8 uses the ECMAScript as specified in ECMA-262, 5th edition.

Reference: http://code.google.com/p/v8/

Sign up to request clarification or add additional context in comments.

4 Comments

None of those describe the implemented version of JS.
Isn't the v8 engine's version what the OP is looking for? I have edited answer to add the JS-version. But that is not subject to change and hence need not be queried.
I am looking for the Javascript version the NODEJS is supported, some of the links in the NODEJS Manual are directed to [developer.mozilla.org/en/JavaScript]
@DSK If you're expecting one of Mozilla's JavaScript versions, those are specific to Mozilla's own product development (Gecko, SpiderMonkey, etc.) and aren't actually relevant to Google's V8 or NodeJS beyond some versions being legacy. ECMAScript 5.1 is the current standard version: "The JavaScript standard is ECMAScript. As of 2012, all modern browsers fully support ECMAScript 5.1."
7

According to its documentation, this command could be used;

node -p process.versions.v8

1 Comment

But then how do I know which JavaScript version that version of V8 uses?
7

Run this script:

try {
  var k = new Map();
  console.log("ES6 supported!!")
} catch(err) {
  console.log("ES6 not supported :(")
}

try {
  var k = new HashMap();
  console.log("ES100 supported!!")
} catch(err) {
  console.log("ES100 not supported :(")
}

1 Comment

what the hell is ES100?
6

The best and most detailed version intel is at https://node.green. It shows a matrix of NodeJS version by JavaScript version. The JavaScript items include the standard name and each js feature. The node version includes the V8 version (hover over the node column header).

Comments

3

Not trying to necropost, here -- however, this seems to be the way to accomplish this...it is a bit convoluted, however.

What I did was -- follow the method outlined here and then added some of my own...

node -p process.versions

{ http_parser: '2.8.0',
  node: '11.2.0',
  **v8: '7.0.276.38-node.11'**,
  uv: '1.23.2',
  zlib: '1.2.11',
  ares: '1.15.0',
  modules: '67',
  nghttp2: '1.34.0',
  napi: '3',
  openssl: '1.1.0i',
  icu: '63.1',
  unicode: '11.0',
  cldr: '34.0',
  tz: '2018e' }

Then, it depends on your platform -- I have node running on Windows 10, so...

node --v8-options | find "in progress"

For Linux use...

node --v8-options | grep "in progress"

  --harmony-do-expressions (enable "harmony do-expressions" (in progress))
  --harmony-class-fields (enable "harmony fields in class literals" (in progress))
  --harmony-static-fields (enable "harmony static fields in class literals" (in progress))
  --harmony-await-optimization (enable "harmony await taking 1 tick" (in progress))
  --harmony-locale (enable "Intl.Locale" (in progress))
  --harmony-intl-list-format (enable "Intl.ListFormat" (in progress))
  --harmony-intl-relative-time-format (enable "Intl.RelativeTimeFormat" (in progress))

V8 implements ECMAScript as defined in ECMA-262-- I am unaware of any way to relate that to any other 'version', however -- it will tell you what features are still in development.

If you omit the pipe to grep/find, you get a long list of all v8 options available.

Finally, I am not actually developing the Node application for use on my Windows 10 machine -- I am developing the Node application for a Raspberry Pi and using Visual Studio Code to ssh, so -- at my terminal prompt, I ssh into the RPi and use the Linux version above...

node -p process.versions

{ http_parser: '2.8.0',
  node: '8.11.3',
  v8: '6.2.414.54',
  uv: '1.19.1',
  zlib: '1.2.11',
  ares: '1.10.1-DEV',
  modules: '57',
  nghttp2: '1.32.0',
  napi: '3',
  openssl: '1.0.2o',
  icu: '60.1',
  unicode: '10.0',
  cldr: '32.0',
  tz: '2017c' }

node --v8-options | grep "in progress"

--harmony_array_prototype_values (enable "harmony Array.prototype.values" (in progress))
--harmony_function_sent (enable "harmony function.sent" (in progress))
--harmony_do_expressions (enable "harmony do-expressions" (in progress))
--harmony_class_fields (enable "harmony public fields in class literals" (in progress))
--harmony_promise_finally (enable "harmony Promise.prototype.finally" (in progress))
--harmony_number_format_to_parts (enable "Intl.NumberFormat.prototype.formatToParts" (in progress))
--harmony_plural_rules (enable "Intl.PluralRules" (in progress))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.