MageHost - Switch NodeJS version using NVM

Gewijzigd op Di, 20 Dec, 2022 om 1:02 PM

Disclaimer: MageHost has joined forces with Savvii. Therefore, these articles are only relevant to existing MageHost customers. For more information on this, visit www.savvii.com/en/magehost.  


Installing NVM

Install Node Version Manager (NVM) on your hostingaccount

mkdir -p ~/.nvm
/opt/nvm/install.sh 

Uninstall NVM from your hostingaccount

rm -rf ~/.nvm

Using NVM

Show the complete help

nvm --help

Install the latest Node.js version

To install the latest available version of Node.js, you can use the following command:

nvm install node

Next, to use that version of Node.js in any new shell, you can simply run the use command:

nvm use node

Install the latest Node.js LTS version

To install the latest available LTS (Long Term Support) version of Node.js, you can run the following command:

nvm install --lts

And to use that latest LTS version of Node.js in any new shell, you can simply run the use command:

nvm use --lts

More usage examples

Install a specific version number:

nvm install 8.0.0 

Use the latest available 8.0.x release:

nvm use 8.0

Run app.js using node 6.10.3:

nvm run 6.10.3 app.js 

Run `node app.js` with the PATH pointing to node 4.8.3:

nvm exec 4.8.3 node app.js 

Set default node version on a shell:

nvm alias default 8.1.0

Always default to the latest available node version on a shell:

nvm alias default node 


Was dit artikel nuttig?

Dat is fantastisch!

Hartelijk dank voor uw beoordeling

Sorry dat we u niet konden helpen

Hartelijk dank voor uw beoordeling

Laat ons weten hoe we dit artikel kunnen verbeteren!

Selecteer tenminste een van de redenen
CAPTCHA-verificatie is vereist.

Feedback verzonden

We stellen uw moeite op prijs en zullen proberen het artikel te verbeteren