Which version of Node.JS should I use? - node.js

The Node.JS website says the current version is 0.10.26, but the git repo has much newer versions going up to 0.11.12.
Is there something wrong with the later versions, are they unstable?
Why does the website say 0.10.26 is the current version?

From the Node.js wiki:
Odd versions are unstable, even versions are stable. v0.2 and v0.4 are even/stable. v0.3 and v0.5 are odd/unstable. The current stable series is v0.10.x. The next stable series will be v0.12.x. The stable branch takes bug fixes only - it does not change the JavaScript API, addon API, nor ABI (you don't have to rebuild modules after upgrading node with-in a stable branch).
You should use stable versions for production. The web site displays prominently and gives links to download the latest stable verson.
However, if you are trying to stay ahead of the curve and prepare for the next and yet unreleased stable version, then testing against an unstable version makes sense. This is why the unstable versions are also available to developers.

Related

Where do I find list of breaking changes for Any NodeJS version

I am currently using node 6.1 in my project.
I want to upgrade it to latest stable version now.
Before doing that I want to know what are the breaking changes introduced in all the versions in between 6 to 12
Is there any place I can get all these breaking changes for the node versions.
I've found this page to be the most helpful list of all major/minor/patch changes:
https://nodejs.org/en/blog/release/v16.0.0/
Another good resource to find changes to all the different major versions, is the changelog archive on nodejs' github:
https://github.com/nodejs/node/tree/main/doc/changelogs

Downgrade node.js from v7 to v0.10 because of old CentOS

I'm downgrading node.js from v7.7.4 to v0.10.48 because I'm on a CentOS 6.5 server and apparently v0.10.48 is the latest it can handle. Are there issues with going backwards like this?
It should work
There are no issues in way that it will work just as well as it did when it was the current version.
But...
There will be issues with the compatibility of modules on npm. Many of the modules may not work. That is partially because Node v0.10 uses V8 v3.14 (for comparison the current Node versions use V8 v5.x) so a lot of modern JavaScript syntax doesn't work there.
Syntax
For details of what syntax works and what doesn't see:
http://node.green/
For example you will not be able to use a simple arrow functions:
const add1 = x => x + 1;
or even the const keyword for that matter. You will miss a lot of syntax that we now take for granted even on the frontend. Remember that io.js was forked from Node v0.12 mainly because it used such an outdated version of V8 - and it was literally years ago and was about a newer and much modern version than the one you want to use.
Core API
Also the core modules changed during that time changed a lot - compare:
https://nodejs.org/dist/latest-v0.10.x/docs/api/
https://nodejs.org/dist/latest-v7.x/docs/api/
Modules
Because current versions of Node support newer language syntax and have improved core API, a lot of the modules on npm will not work correctly or at all. Make sure that whatever module you use still supports Node v0.10 or use an old version that did support it. You may need to use shrinkwrap to downgrade a lot of sub-dependencies because even if you use an old version of a module that used to work on Node v0.10, it may still load the latest versions of its dependencies that don't work any more.
Security
Also there will be potential issues with bugs and vulnerabilities that will not get fixed. The v0.10 version manitenance ended on 2016-10-31 and the status of this version is currently: End-of-Life. The oldest version that is still maintained today (as of May, 2017) is 4.x.
See:
https://github.com/nodejs/LTS

How to change or upgrade the version of Node.js and npm in a Meteor app without updating Meteor

Meteor is typically behind in Node.js version because it is a framework that uses its own bundled version of Node.js, and its APIs and features are built to rely on that version of Node.js.
I'm sure that in many cases upgrading Node.js poses no problem.
As an example, Meteor 2.10 at time of writing ships with Node.js 14. But we're already on Node.js 19.
Is there a way to tell Meteor (f.e. with the meteor cli, or some meteor package) to use newer versions of Node.js (and npm)?
Meteor 1.4 now supports Node 4.4.7!
See release notes
To upgrade to Meteor 1.4:
Go to the root of your project's directory
meteor update
Meteor does not support NodeJS 4+ as of now. The discussion is available in https://github.com/meteor/meteor/issues/5124
The latest update to the thread on April 29 is:
Guys, relax. The difference between Node version 4, 5 and 6 are relatively minor, and so if Meteor can support one, it can and will support all others. Ben created PRs for every currently active and supported Node version, but the fundamental part of the work is about making Meteor work with any (recent, non-legacy) Node version, and from there basically everyone should be able to freely select whichever one fits their goals and intentions best (i.e. 4.x if you don't care for bleeding edge Node, 6.x if you do; 5.x is not going to stick around for very long as it's not an LTS version).
So come and check out and help with the PRs if you're interested and
you can, but if not, just rest assured this is being worked on and
prioritized appropriately and I'm pretty sure Ben (and/or others
working on this) will keep everyone posted on any meaningful progress.

NodeJS Versioning Questions

Is there an explanation why NodeJS latest version is 6.2.1 but the LTS is 4.4.5? It might seem odd but shouldn't they stabilized version 5 first before working on or releasing version 6?
https://nodejs.org/en/
The reasoning behind this is that Node works to a 'LTS schedule':
New major version releases (i.e. the x in x.y.z) are created from the master branch every six months - even-numbered releases in April, odd-numbered releases in October.
Whenever a new odd-numbered release comes out, the previous even-numbered release moves into LTS, meaning there should be no breaking changes to that version from that point on.
The LTS version will be supported for 18 months, after which it will go into maintenance mode for 12 months, meaning it will only receive critical/security related updates. Because of this, there will never be more than two LTS versions active at the same time.
If it helps you visualize it, there's a diagram of the schedule on the Node LTS GitHub:
This allows there to be a predictable release schedule and migration path for those who have to support their Node infrastructure long-term, while keeping the pace of development moving for those who want to stay on the cutting-edge of new features. Bear in mind that under SemVer (the versioning scheme that Node uses), breaking changes are only allowed in major-version releases - having a regular schedule for these coming out ensures that these changes can be tested before they get added to an LTS version further down the line.
For more info, I recommend taking a look at the Node LTS GitHub - this is where I got all this information from, and it's a pretty helpful resource.

socket.io and pm2 : how does version number in node.js works?

when I run
node -v
I got 4.2.1 which is very strange since I remember I worked with 0.10 versions: I am totally lost with nodejs versions
reading the pm2 doc
Warning: If you want to use the embedded load balancer (cluster mode),
we recommend the use of node#0.12.0+ or node#0.11.16+. We do not
support node#0.10.*'s cluster module anymore.
I don't understand how node.js versions works: looks like we jumped form 0.10
to 4.2
Does pm2 works with latest version of node.js ?
regards
don't understand how node.js versions works: looks like we jumped form 0.10 to 4.2
When io.js and node.js merged, then node.js jump directly to 4.x series. This happened due to difference in versions of io.js (3.x series) and node.js (0.x series). So next common version was named 4.x series and this lead to some confusion. See this announcement.
Does pm2 works with latest version of node.js ?
You can give it a try yourself, but IMO it should work well.
At the end of 2014, node was forked into io.js for reasons I won't cover here.
The io.js project adopted the semver notation and, as the pace of changes was very fast (we got all the recent advances of ES6 that were already available in V8), came to version 3.
In september 2015, io.js was merged back into node, and it was decided to keep the semver versionning, and to go to version 4. More details here, including the LTS.
This makes it possible to deal with a monotonous version order, thus a 4.0 version of node is greater than a 0.11 version. But be wary, many changes were introduced and the ecosystem is big. You'll probably have changes to do when going from 0.x to a new version, especially if you use many modules.

Resources