Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including node-version with all npm packages installed. Try it out:

var nodeVersion = require("node-version")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

node-version v2.0.0

Get Node current version

NPM Version NPM Downloads Linux Build Windows Build Circle CI Build Codecov

Dependency Status devDependency Status

Node-version

A quick module that returns current node version parsed into parts.

Installation

yarn add node-version

Or

npm install node-version

Quick Start

var currentVersion = require('node-version');

/*
console.log(currentVersion);

{
    original: 'v0.4.10', // same as process.version
    short: '0.4',
    long: '0.4.10',
    major: '0',
    minor: '4',
    build: '10'
}
*/

Warning

Version 1.0.0 break 0.1.0 since its API changes.

Change

var currentVersion = new (require('node-version')).version();

To

var currentVersion = require('node-version');
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free