Soul Reaver
Soul Reaver

Reputation: 2092

How to verify node.js version (other than node -v)

I have this strange issue, where I am using 10th version of node (10.9.0) on a server, but things that should work or be supported in that version, are not. For example, according to this table, this version supports Object.values(). On my local node installation - this indeed works, but on server, where I don't have much freedom about what software I am using, it does not.

Is there any way to truly verify used node version (node -v shows 10.9.0 as written above)? Maybe it's only a version of main binary yet all libs it's using are from version 6 (that one is also installed on that server)?

Upvotes: 0

Views: 107

Answers (1)

Charlie Fish
Charlie Fish

Reputation: 20496

The process object that Node.js exposes has a lot of information including the version.

console.log(process.version); // v10.9.0

You can find the Node.js process.verison documentation here.

So within your application you can run that to see if it's truly what you expect.

You can also try running which node on your server. That should print the path it's using to find node. If you have multiple copies or installations of node, it might be using a path that is outdated. Making sure your path is up to date will solve that problem, and which node can help debug that.

Upvotes: 3

Related Questions