Upgrading Node.js on a Laravel Forge Provisioned Server

| 1 min read

I just upgraded Node.js on a Laravel Forge provisioned Ubuntu server for the umptieth time. I can never remember how to upgrade to a higher major Node.js version, so I’m documenting the process for future me.

Node.js is installed through a debian repository on Forge. Upgrading with apt-get will upgrade to the latest minor or patch version, but won’t upgrade to a higher major version.

sudo apt-get update && sudo apt-get upgrade

I wanted to upgrade from Node 6 to Node 8. To jump to a new major version, I modified a nodesource.list file.

sudo vi /etc/apt/sources.list.d/nodesource.list

The nodesource.list file looks like this:

deb https://deb.nodesource.com/node_6.x xenial main
deb-src https://deb.nodesource.com/node_6.x xenial main

To upgrade to a higher Node version, like version 12.x, modified the numbers to the following:

deb https://deb.nodesource.com/node_12.x xenial main
deb-src https://deb.nodesource.com/node_12.x xenial main

Next, run the usual apt-get upgrade commands:

sudo apt-get update && sudo apt-get upgrade

And done! You can run node -v to ensure you’re on the latest version of Node.


I occasionally send out a newsletter with personal stories, things I’ve been working on in the past month, and interesting things I come across.

Pinky swear that I won't use your data for any other purposes. Your email address will be stored on Mailchimp and nowhere else.

More about Laravel Forge & devops

Webmentions ?