To update node.js version to 18, 20, 21, or 22, just type nvm install <node-version> command to install the new version, and type nvm use <node-version> to switch to the new version on linux ubuntu
Read More How to Update Node.js to Version [18, 20, 21 ,22] Ubuntu Linux