Misskey NodeJS (NVM with PM2) update steps

Misskey is under heavy development and event minor update need higher version of NodeJS. In this article, I want to share my experience how to perform an update to Misskey instances which run using PM2 and NVM

If you’re following my article about How to install Misskey in Ubuntu 22.04 (Manual Node.js and PM2 without Docker), you may encounter some problem when trying to update your Misskey instances.

This because Misskey is under heavy development and event minor update need higher version of Node.js. For example, Misskey 13.10.3 was released in March, 25th, and it works well with Node.js 18.15. Last week (May, 12th), Misskey 13.12.2 was released and need to be run using (at least) on Node.js 18.16. In this article, I want to share my experience how to perform an update to Misskey instances.

Install / update required dependencies for new version

First you need to know what is the minimum requirement (dependencies) for the latest stable version of Misskey, especially for Node.js version and PostgreSQL. I’ll take example of upgrading Misskey from 13.10.3 to 13.12.2 which have different minimum requirement of Node.js version.

Node.js

1nvm install 18.16
2use 18.16

Install corepack and enable it from your new Node.js version environment:

1npm install -g corepack
2corepack enable

PM2

If you see “In-memory PM2 is out-of-date” message from pm2 You may want to update your pm2 package (optional):

  1. Stop and delete all your current pm2 process (see the processes with pm2 ps command):
1pm2 delete nameOfProcess
  1. If you using systemd to start the pm2 process, unstartup it with pm2 unstartup systemd and execute the output from your shell.
1pm2 unstartup systemd
  1. Update and re-enable pm2 process:
1pm2 update
2pm2 startup

Don’t forget to execute the output of pm2 startup command.

Update Misskey

After all required dependencies is installed, update the Misskey app itself. Navigate to your Misskey installation directory and execute these commands:

1git checkout master
2git pull
3git submodule update --init
4NODE_ENV=production pnpm install --frozen-lockfile
5NODE_ENV=production pnpm run build
6pnpm run migrate

Then re-run Misskey using PM2:

1pm2 start "NODE_ENV=production pnpm run start" --name <your_process_name>

If you encounter any problems with updating, try to run pnpm run clean-all command and retry the Misskey update process.