To install a specific NPM version in case NPM is already installed (meaning, to upgrade or downgrade the installed NPM version) you can use NPM itself!
An example, using a Script step (simply add a Script step to the workflow, can be the very first step in the workflow, then specify this script as its content):
#!/usr/bin/env bash set -ex # install a specific NPM version, with the `-g` / `--global` flag to replace the previously installed version npm install -g npm@4
P.S.: of course don’t forget to specify the version you want to install. The script above will install the latest NPM 4.x version. To specify another NPM version simply replace
npm@4 in the script with the
npm@VERSION you want to use