Please check out our holiday schedule for support availability

Update and Manage Node.js version with n

Last Updated -


Every Pagely VPS has the standard Node.js package installed from the Ubuntu repository. The package manager for Node.js is npm, which is also installed. With these two tools installed on the system, you have the control to manage specific versions in the context of your own SSH user accounts and projects. We generally do not recommend changing the version installed globally on the system.

If you require a specific version of Node.js This article will discuss how to install n, the version management library for Node.js

What you'll need

  1. A Pagely VPS
  2. An SSH user with access to your VPS

What you'll need to do

There will be seven steps

  1. log in
  2. install n
  3. make a custom directory
  4. change default prefix of version installs
  5. install a version
  6. test
  7. alias the command

Step 1: log in to your server

ssh pagelyuser@pagelyserver.vps.pagelyhosting.com

ssh-login.gif

Step 2: install n

npm install n

npm-install-n.gif

Step 3: make the "n" folder in your home directory

mkdir ~/n

mkdir.gif

Step 4: Run export N_PREFIX to change default....

"Activated versions are then installed to the prefix /usr/local, which may be altered via the N_PREFIX environment variable.

To alter where n operates, simply export N_PREFIX." - n documentation

export N_PREFIX=$HOME/n

n-export.gif

Step 5: add the version you desire to the 'n' directory with the following command...

~/node_modules/n/bin/n 11.1.0

install-node-version.gif

Step 6: Check to make sure this worked...

 ~/n/bin/node --version

test.gif

Step 7: Alias

alias n="~/n/bin/node"

alias-n.gif

For further instructions, please refer to the n documentation, or...

n --help

Related Topics

Pagely is the Managed WordPress Hosting Platform designed to exceed the needs of media, business, and Enterprise customers alike. We help the world's biggest brands scale WordPress.

Copyright © 2006-2017 Pagely, Inc. All rights reserved.
Pagely® and WordPress® are registered trademarks.

Pagely
Powered by Zendesk