-2

Nodejs version can be checked by using node -v, but how can I check the latest version available in nodejs using npm?? Using JavaScript I can access the nodejs version by using "process.version". Is there a way to check the latest version of nodejs available using JavaScript.

Shashank
  • 41
  • 3

1 Answers1

0

You would have to do something like parsing the list of Node downloads (https://nodejs.org/dist/) and extracting the highest version number.

Do note though that if they change their URL structure or something (unlikely for something as established as Node.js, but possible), it would break.

The running instance of Node itself wouldn't have any inherent way to know what other versions are out there.

samanime
  • 25,408
  • 15
  • 90
  • 139