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
- A Pagely VPS
- An SSH user with access to your VPS
What you'll need to do
There will be seven steps
- log in
- install n
- make a custom directory
- change default prefix of version installs
- install a version
- alias the command
Step 1: log in to your server
Step 2: install n
npm install n
Step 3: make the "n" folder in your home directory
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
Step 5: add the version you desire to the 'n' directory with the following command...
Step 6: Check to make sure this worked...
Step 7: Alias
For further instructions, please refer to the n documentation, or...