node.jsvisual-studio-code

How to find NODE_MODULE_VERSION?


Is it possible to know NODE_MODULE_VERSION in Node.js? If yes, then how? I am interested specifically in the VSCode's builtin Node.js, but maybe Node.js doesn't expose the variable, but VSCode API does?


Solution

  • To access in node what electron refers to as NODE_MODULE_VERSION, you use:

    process.versions.modules


    Other values in that object:

    > console.log(process.versions)
    {
      "http_parser": "2.8.0",
      "node": "8.16.2",
      "v8": "6.2.414.78",
      "uv": "1.23.2",
      "zlib": "1.2.11",
      "ares": "1.10.1-DEV",
      "modules": "57",
      "nghttp2": "1.39.2",
      "napi": "4",
      "openssl": "1.0.2s",
      "icu": "60.1",
      "unicode": "10.0",
      "cldr": "32.0",
      "tz": "2017c"
    }