Dealing with applications when upgrading the node.js version

Warning

First, please check the source of the application to see if there is a separate guide for this case and follow it if so.

Note

The following steps assume that the application is installed account-wide, not in a separate directory, so npm is called with the flag --global. If your application is installed to a specific directory, omit the --global from the following steps and enter your application’s directory before running the npm commands.

Upgrade Node.js App

Preparation

If your application runs as a service, stop it:

[isabell@stardust ~]$ supervisorctl stop <app>
<app>: stopped
[isabell@stardust ~]$

Now the application including all packages should be updated to the latest version.

[isabell@stardust ~]$ npm --global update
...
added 2 packages and updated 9 packages in 10.521s
[isabell@stardust ~]$

Perform Upgrades

Set the new node.js version:

[isabell@stardust ~]$ uberspace tools version use node <xy>
Selected node version <xy>
The new configuration is adapted immediately. Patch updates will be applied automatically.
[isabell@stardust ~]$

Under the new version all installed packages should be rebuilt once:

[isabell@stardust ~]$ npm rebuild --global
rebuilt dependencies successfully
[isabell@stardust ~]$

And then be provided with the available updates for the new version:

[isabell@stardust ~]$ npm update --global
...
added 9 packages and updated 22 packages in 33.211s
[isabell@stardust ~]$

Restart Service

Now you can start the service again:

[isabell@stardust ~]$ supervisorctl start <app>
<app>: started
[isabell@stardust ~]$