Can't execute the migration script for v8.x on a Debian 12 Bookworm

Hi

I installed the 8.1.8 version over a 7.2.3 with no problem on a Debian 13 Trixie release.

On two Debian 12 Bookworm I have the same problem : a MODULE_NOT_FOUND error sent by the migration script. I tried to install the 8.2 RC 3 and of course same result.

I used the same commands order on both:

  • upgrading Node.js
  • installing pnpm
  • launching PeerTube upgrade script
  • updating the production.yaml file (which has not the same content on the three server after the upgrade, a little strange, but I fixed that)
  • PeerTube starts in the new release (8.1.8 or 2.0 RC3) and the website is ok but no thumbnails which is normal at this stage
  • launching the migration script, ok on Debian 13, not ok on Debian 12
  • on Debian 13 the regenerate-thumbnails and prune-storage scripts worked as expected, I launched them on a Debian 12 and they crash, on the third server I haven’t tried anything after the migration script crash

Here is the error message :

debian@vps-XXXXX:/var/www/peertube/peertube-latest$ cd /var/www/peertube/peertube-latest && sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production node dist scripts/migrations/peertube-8.1.js
node:internal/modules/cjs/loader:1496
  throw err;
  ^

Error: Cannot find module '/var/www/peertube/versions/peertube-v8.2.0-rc.3/dist'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1493:15)
    at wrapResolveFilename (node:internal/modules/cjs/loader:1066:27)
    at defaultResolveImplForCJSLoading (node:internal/modules/cjs/loader:1090:10)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1111:12)
    at Module._load (node:internal/modules/cjs/loader:1279:25)
    at wrapModuleLoad (node:internal/modules/cjs/loader:257:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

pnpm version is 11.3.0
npm version is 11.15.0
Node.js version is 24.15.0

I tried some commands I found on this forum and GitHub issues, but nothing fixed the problem. Of course no solution come from the “6 letters evil” search engine.

For security reasons I preferred to stop PeerTube on the 2 instances with the error. I’ll go back to 7.2.3 or move the websites to an other VPS on latest Debian release in a few days if no solution appears.

PS : je me demande après coup pourquoi j’ai écrit en anglais, étrange. :wink:

There’s a typo in the migration script: node dist scripts/migrations/peertube-8.1.j. It must be node dist/scripts/migrations/peertube-8.1.js

Thanks a lot. I don’t understand what happened.

I copy/paste the commands from the website (release page or PeerTube doc) to a text file and after that to the terminal for each instance. Where and how the “/” disappeared is a mystery. It’s on my text file but by copy/pasting the line again it worked as expected on both VPS.