{"id":17753,"date":"2026-11-02T19:49:29","date_gmt":"2026-11-02T14:19:29","guid":{"rendered":"https:\/\/www.skynats.com\/blog\/?p=17753"},"modified":"2026-11-02T19:49:29","modified_gmt":"2026-11-02T14:19:29","slug":"how-to-upgrade-node-js-20-to-24-on-linux-server","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/how-to-upgrade-node-js-20-to-24-on-linux-server\/","title":{"rendered":"How to Upgrade Node.js 20 to 24 on Linux Server"},"content":{"rendered":"<h2><b>Introduction<\/b><\/h2>\n<p>Node.js is a critical component of modern backend applications. Keeping the runtime up to date helps applications remain compatible with dependencies, receive ongoing security fixes, and benefit from improvements in the JavaScript runtime.<\/p>\n<p>Upgrading Node.js 20 to 24 on a <span style=\"color: #999999;\"><a style=\"color: #999999;\" href=\"https:\/\/www.linux.org\/\" target=\"_blank\" rel=\"noopener\">Linux<\/a><\/span> server requires careful planning, particularly when applications are managed using NVM and PM2. A successful upgrade involves installing the new runtime, checking application compatibility, updating process management configurations, and verifying that applications continue to run correctly.<\/p>\n<p>The objective was to install Node.js v24.22.1, preserve the existing version for rollback, and ensure that PM2-managed applications and future deployments consistently use the new runtime.<\/p>\n<h2><strong>How do you upgrade Node.js 20 to 24 on a Linux server?<\/strong><\/h2>\n<p>You can upgrade Node.js 20 to 24 on a Linux server using NVM (Node Version Manager). Install the required Node.js version, switch the active runtime, update PM2 configurations, restart applications, and verify their functionality. Always check dependency compatibility and maintain a rollback plan before making changes to a production server.<\/p>\n<h3><b>1. Understanding the existing environment<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The application server used the following stack:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Operating system: Linux<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Runtime manager: NVM for Linux<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Existing Node.js version: v20.19.6<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Target Node.js version: v24.22.1<\/span><\/li>\n<\/ul>\n<h3><b>2. Installing Node.js v24 using NVM<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">NVM allows multiple Node.js versions to coexist on the same machine. This is useful when maintaining legacy applications while preparing a newer runtime. First, verify that NVM is available:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">command -v nvm<\/span><\/p>\n<p><span style=\"font-weight: 400;\">nvm ls<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Install the required version:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">nvm install 24.22.1<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Verify that it is installed:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">nvm ls<\/span><\/p>\n<p><span style=\"font-weight: 400;\">nvm exec 24.22.1 node -v<\/span><\/p>\n<p><span style=\"font-weight: 400;\">nvm exec 24.22.1 npm -v<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">The <a href=\"https:\/\/www.skynats.com\/blog\/how-to-install-node-js-on-ubuntu-24-04\/\">Node.js<\/a> version command should return: <\/span><b>v24.22.1<\/b><\/p>\n<p><span style=\"font-weight: 400;\">At this stage, Node.js v20.19.6 remains installed. Installing v24 does not automatically change the runtime of an application that is already running.<\/span><\/p>\n<h3><b>3. Changing the default Node.js version<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">After verifying the installation, the default NVM version can be changed:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">nvm alias default 24.22.1<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Verify the active version and executable path on another shell:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">node -v<\/span><\/p>\n<p><span style=\"font-weight: 400;\">which node<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Expected output includes:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>v24.22.1<\/b><\/p>\n<p><b>\/root\/.nvm\/versions\/node\/v24.22.1\/bin\/node<\/b><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><b>4. Restart Your Application and Monitor Logs<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">After upgrading Node.js, restart your application to ensure it runs on the new runtime. The restart method depends on how your application is managed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you manage your application with PM2 in cluster mode, you can use:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">pm2 reload my-app<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">Monitor application logs for the first few minutes after the restart to catch startup failures, dependency issues, or runtime errors.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Look for errors such as missing modules, incompatible dependencies, configuration problems, failed database connections, or unexpected process exits. Finally, verify the application&#8217;s health endpoint and test its critical functionality.<\/span><\/p>\n<h4><b>5. Conclusion<\/b><\/h4>\n<p><span style=\"font-weight: 400;\">Upgrading Node.js from v20 to v24 involves more than installing a new runtime. In an environment using NVM, PM2, and automated deployments, the interactive shell, PM2 daemon, and deployment pipeline can each have different runtime configurations.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The key lesson is to configure the intended <a href=\"https:\/\/www.skynats.com\/blog\/how-to-install-node-js-using-nvm\/\">Node.js version<\/a> explicitly, validate it at the process level, and test the application after restarting it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A controlled upgrade, a verified deployment pipeline, and a tested rollback plan help make the transition safer and more repeatable across development, SIT, UAT, and production environments.<\/span><\/p>\n<h3>Need Professional Help with Node.js Server Management?<\/h3>\n<p>Managing Node.js applications in production requires more than routine version upgrades. Runtime compatibility, dependency management, process monitoring, deployment configurations, and server stability all need proper attention.<\/p>\n<p>An improperly managed upgrade can lead to application downtime, unexpected errors, and deployment failures.<\/p>\n<p>Skynats provides <a href=\"https:\/\/www.skynats.com\/server-management\">professional server management<\/a> and <a href=\"https:\/\/www.skynats.com\/server-management\">cloud infrastructure support<\/a> to help businesses maintain secure, stable, and reliable server environments.<\/p>\n<p>Whether you are planning a Node.js upgrade, managing production applications, or facing server performance and compatibility issues, our team can help you manage your infrastructure requirements.<\/p>\n<p>Need assistance with your server environment? <a href=\"https:\/\/www.skynats.com\/contact-us\">Contact Skynats<\/a> for <a href=\"https:\/\/www.skynats.com\/server-management\">professional server management support<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Node.js is a critical component of modern backend applications. Keeping the runtime up to date helps applications remain compatible with dependencies, receive ongoing security fixes, and benefit from improvements in the JavaScript runtime. Upgrading Node.js 20 to 24 on a Linux server requires careful planning, particularly when applications are managed using NVM and PM2. [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-17753","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/17753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=17753"}],"version-history":[{"count":1,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/17753\/revisions"}],"predecessor-version":[{"id":17756,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/17753\/revisions\/17756"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=17753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=17753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=17753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}