node.js upgrade from v0.12.6 - node.js

Currently we are using node.js v0.12.6 in linux and i need to upgrade to the latest version. From the download site https://nodejs.org/en/download/ , I can download node-v4.4.1-linux-x64.tar.
1) Can you please suggest whether i can upgrade from v0.12.6 to v4.4.1 directly?
2) Is there any documents to refer for this upgrade.
3) In the previous releases: https://nodejs.org/en/download/releases/, i see Vo series of node.js ends with Node.js v0.12.12. so just want to make sure that i am upgrading to the right version.
Thanks
Siva.

I have gone through several upgrades of Node (starting from 0.4.x and now on 4.x). As with all runtime upgrades (not just Node) there is no standard procedure. However the process I outline below should probably help:
On your development and QA machines, use NVM, to start with source(0.12.6) and migrate to target(4.4.1):
Install NVM from here: https://github.com/creationix/nvm
Go through the instructions to install node 0.12.6, and install all your packages and dependencies.
Run your tests and ensure everything is working as expected for your source environment
Create and switch to a new branch of your code for 'upgrade'
nvm install v4.4.1
upgrade each of your npm dependencies manually, commit package.js granularly
Run your tests and fix where needed, commit fixes granularly
When you are confident, you should have a new branch that works as desired on the new version (4.4.1)
Have QA follow their testing procedures on the new 'upgrade' branch
Go through a normal test/fix cycle with branch and merge from/to 'upgrade'
When everyone is happy, merge upgrade and launch.
Good Luck!

Related

What is a sustainable method to upgrading node from old versions to latest?

I would like to upgrade a few projects from Node 8 to the latest Node version.
Amazon mentioned that Node 12 is now deprecated.
I assume there is much more to consider than simply upgrading the package version, considering these projects would have many packages installed and there could be breaking changes.
What is the approach I should take in upgrading them to the latest Node version without breaking existing functionality?
Updating
It depends on how are you running Node. If it is inside a docker container, you may update the image definition in your docker.compose file:
(note: I am using 16 as demo here)
# specify the node base image with your desired version node:<version>
FROM node:16
If you have it deployed as a Node project, you can set the engines field in your package.json:
"engines" : {
"node" : ">=16.0.0"
}
Lastly, if we are speaking about your local computer, you can uninstall Node and re-install the wanted version or use a version manager, like nvm.
Updating locally with nvm:
nvm install 16.0.0
nvm use 16.0.0
Considerations
Make sure everything works and that your dependencies can run in the new environment. A robust test suite and a proper CD/CI pipeline are essential to guarantee appropriate functioning.
$ yarn global add n
$ n latest
or
$ npm install -g add n
$ n 18
n allows you to manage several node versions with ease, i've been using it for years

Co-Existience of two different NodeJS for same project

I am quite new to NodeJS and am planning to upgrade NodeJS version for my current project. The most recent NodeJS LTS is installed using NVM.
I need to keep switching between the current LTS that i am using and the new LTS that has been installed. I understand that i can do 'NVM use' for this purpose. npm-shrinkwrap.json is being used to lock down the npm package dependencies.
I am planning to follow the below approach both in my dev machine and build machine;
Is it okay? If not, please suggest a best approach.
nvm use latest_LTS
Update the package.json to pick the version which is supported by
latest_LTS
npm install
generate testing_build
Whenever i need to generate a build for current release (with the previous LTS NodeJS)
nvm use currently_used_LTS
clear the node modules
npm install (Release npm-shrinkwrap.json)
generate release_build
Thanks
In theory that should work.
However have you considered the option of just doing a point release for the current release_build that does nothing except version-bump node?
You may find (after re-running your tests) that the latest version of node is backwards compatable with release_build (or only requires minor fixes), and you can simplify your life by porting everything to the latest node version, rather than constantly switching

How to upgrade nodejs to latest version

I'd like to upgrade from the LTS to 8.x. I need to integrate this into an existing project. What's the best way to do that so that my project continues to work no problems after the upgrade?
(I'm on windows).
Since you are using windows it is easy to upgrade to the latest node js version.
Just reinstall node from the .msi in Windows from the node website.
That will do the trick.
Your project will not be affected after the upgradations.
Also, npm will be upgraded as well.
It's safe to do the following after the upgradations.
npm cache clean
npm update -g
EDIT
I just want to add the use of nvm that manages multiple node versions without any conflicts to each other versions.
You could look into it here

How to understand the difference of edition in NodeJS? [duplicate]

I installed Node JS several months ago and played around a bit. Today, I wanted to start learning more about node and before coding, I decided I wanted to make sure I had the latest version.
I checked the version and it was something like v0.10.3x. I looked on the NodeJS website and it shows the latest version as v4.1.0. So I thought Woahhh! I better upgrade and I couldn't believe it moved that fast to a 4.x version in only a few months.
I spent quite some time trying to figure out how to completely uninstall node and npm because I couldn't seem to upgrade it.
Finally I got it all ripped out, then installed in on CentOS 7 using yum. I know I won't get the latest version through yum but, I figured it would be close enough.
After install, I am at v0.10.40.
I have a feeling I just don't understand something about NodeJS version numbers.
Yeah if you only used the official node.js runtime then it would have appeared to jump from 0.12.x all the way to 4.0.0 in one fell swoop. What you may not have known was that node devs that were sick of how much the node repository was stagnating made a fork of the project and called it io.js. Under the io.js name the project marched forward over the last six months or so; it started at v1.x and iterated all the way through 2.x and 3.x in that time. Old node.js used a different versioning system wherein the odd versions were unstable and even versions were stable. Io.js switched to using semver versioning semantics like packages on npm already use.
After a lot of deliberation Joyent (original maintainers of node.js) finally caved in and helped form a proper open committee around node in an effort to push the project forward in much the same way io.js was already doing. A few months ago they agreed to merge io.js back into node.js (which was the goal of those who created io.js in the first place). They finally finished merging the two projects recently. The name io.js is no more and node.js lives on starting at v4.0. It will continue to use semver semantics like io.js did :)
Going forward things with node will be MUCH simpler. I'm excited to see where the project goes from here.
That is because since v4.0, the Node.js project and the io.js project that are now combined.
As for the io.js project, the version numbers were like v3.x, v2.x and v1.x.
Reference https://nodejs.org/en/blog/release/v4.0.0/
You can use NVM(Node Versioning manager) for avoiding confusion.
Benefit of this package is you can switch b/w two versions according to your convenient. Its a very easy to use tool.
https://www.liquidweb.com/kb/how-to-install-nvm-node-version-manager-for-node-js-on-ubuntu-12-04-lts/
if you use npm you can upgrade with
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
once done try node -v to see what you got
see more at http://davidwalsh.name/upgrade-nodejs
You can update node or npm using command line. You need to have a version of node or npm installed in your machine.
Use the following command in you terminal.
npm install node -g
npm install npm
You can also install the specific version of node, Like this.
npm install node#8.1.3
npm install npm#4.1.2
Here 8.1.3 is a version number. Use any of the version you want to install.

NodeJS version number confusion

I installed Node JS several months ago and played around a bit. Today, I wanted to start learning more about node and before coding, I decided I wanted to make sure I had the latest version.
I checked the version and it was something like v0.10.3x. I looked on the NodeJS website and it shows the latest version as v4.1.0. So I thought Woahhh! I better upgrade and I couldn't believe it moved that fast to a 4.x version in only a few months.
I spent quite some time trying to figure out how to completely uninstall node and npm because I couldn't seem to upgrade it.
Finally I got it all ripped out, then installed in on CentOS 7 using yum. I know I won't get the latest version through yum but, I figured it would be close enough.
After install, I am at v0.10.40.
I have a feeling I just don't understand something about NodeJS version numbers.
Yeah if you only used the official node.js runtime then it would have appeared to jump from 0.12.x all the way to 4.0.0 in one fell swoop. What you may not have known was that node devs that were sick of how much the node repository was stagnating made a fork of the project and called it io.js. Under the io.js name the project marched forward over the last six months or so; it started at v1.x and iterated all the way through 2.x and 3.x in that time. Old node.js used a different versioning system wherein the odd versions were unstable and even versions were stable. Io.js switched to using semver versioning semantics like packages on npm already use.
After a lot of deliberation Joyent (original maintainers of node.js) finally caved in and helped form a proper open committee around node in an effort to push the project forward in much the same way io.js was already doing. A few months ago they agreed to merge io.js back into node.js (which was the goal of those who created io.js in the first place). They finally finished merging the two projects recently. The name io.js is no more and node.js lives on starting at v4.0. It will continue to use semver semantics like io.js did :)
Going forward things with node will be MUCH simpler. I'm excited to see where the project goes from here.
That is because since v4.0, the Node.js project and the io.js project that are now combined.
As for the io.js project, the version numbers were like v3.x, v2.x and v1.x.
Reference https://nodejs.org/en/blog/release/v4.0.0/
You can use NVM(Node Versioning manager) for avoiding confusion.
Benefit of this package is you can switch b/w two versions according to your convenient. Its a very easy to use tool.
https://www.liquidweb.com/kb/how-to-install-nvm-node-version-manager-for-node-js-on-ubuntu-12-04-lts/
if you use npm you can upgrade with
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
once done try node -v to see what you got
see more at http://davidwalsh.name/upgrade-nodejs
You can update node or npm using command line. You need to have a version of node or npm installed in your machine.
Use the following command in you terminal.
npm install node -g
npm install npm
You can also install the specific version of node, Like this.
npm install node#8.1.3
npm install npm#4.1.2
Here 8.1.3 is a version number. Use any of the version you want to install.

Resources