1

There are now several forks of nodejs for various reasons.

For my node code to see which fork it is running under, what is currently the best way?

The forks I am aware of are:

  • The official nodejs release
  • iojs - I guess it's now deprecated since it's rejoined the official nodejs, but it's still of interest
  • JXcore - a fork that supports multiple CPUs/core; multiple JS engines including V8, Mozilla's SpiderMonkey, and Microsoft's ChakraCore; and packaging of js apps so npm doesn't need to be used by users of the apps
  • Microsoft's fork of nodejs using their Edge browser's ChakraCore JS engine via a V8-compatibility shim

(I've also asked a companion question about detecting which JS engine is being used. This question is only about detecting which fork is being used.)

Cœur
  • 37,241
  • 25
  • 195
  • 267
hippietrail
  • 15,848
  • 18
  • 99
  • 158
  • This question has been downvoted but [a previous question asking only about nodejs vs iojs](http://stackoverflow.com/questions/28259154) that I just found has seven upvotes. Is it just my wording? – hippietrail Feb 01 '16 at 10:02

1 Answers1

4

NodeJS and iojs can be probably checked by process.release :

name: a string with a value that will always be 'node' for Node.js. For legacy io.js releases, this will be 'io.js'.

As for JXcore you can use either process.jxversion or typeof jxcore !== 'undefined'

infografnet
  • 3,749
  • 1
  • 35
  • 35
  • Yes I couldn't get io.js to install since I have a node.js from after the projects re-merged. In JXcore, `process.release` is a function that can't be called. The MS port of NodeJS also has 'node' at `process.release.name` but has several other differences. – hippietrail Feb 04 '16 at 11:23
  • 1
    Yes, `process.release` in JXcore is currently something else than in NodeJS as it was added to JXcore before NodeJS had it (so that brings a name convergence https://github.com/jxcore/jxcore/issues/790) – infografnet Feb 04 '16 at 14:14