PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 4, 2022

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

 November 04, 2022     lambda, node.js, upgrade     No comments   

Issue

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?


Solution

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.



Answered By - Jonatan Kruszewski
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing