You can use 'n' (`npm install -g n`) for node versions, but switching npm versions may be more difficult. If you're trying to run this as part of a CI/CD pipeline and you can run on a machine that supports Docker, you can use `docker run node:$VERSION` to select which version to use. The list of available versions is here:
https://hub.docker.com/_/node/ . For example: `docker run --rm --volume ./:/data node:6.14.4-jessie "npm install"`
This will mount your current directory to /data in the container running Debian Jessie with node version 6.14.4 and run `npm install`. (the --rm flag will remove the container when it's exited; good for CI.)