Sometimes software does not only require node or npm but a specific version of these programs. I met this case when developing within the masterportal framework, the open source software that e.g. powers https://geoportal-hamburg.de/geo-online/).
So what to do if the versions installed on your machine do not meet the requirements? nvm to the rescue! nvm is the Node Version Manager. You can find it at https://github.com/nvm-sh/nvm
Let's see what node and npm versions are installed on my tiny desktop machine, a Raspberry Pi 4 with 8 GB RAM.
node -v; npm -v yields
At the moment (2020-09-09) that is the leading edge version - when time permits I will document how to install the latest version of node on Raspian (or Ubuntu/Debian).
So what does the install documentation for masterportal say? The latest versions that have been shown to work are Node.js 10.15.3 LTS with NPM 6.4.1. So let us tell nvm that we need node.js 10.15.3 and want the latest NPM version compatible with it:
nvm install 10.15.3 --latest-npm
When the command has terminated the active versions of node and npm are as desired,
node -v; npm -v now yields