Trying upgrade from v1.12.2 to v4, let me do a record

submitted by

Migrate nodebb to a new machine

from to
OS Ubuntu 22.04.5 LTS Debian 12
nvm version 12 20
mongodb version 6 8
nodebb version v1.12.2 v4.2.1
1

Log in to comment

4 Comments

Some plugins installed through the old ACP are no longer on the whitelist in the new ACP due to being outdated, making them impossible to uninstall using the new ACP panel. However, while npm uninstall works, they reappear after a reset (could it be that the plugin list is being read from the database?)
My next step is to try and reproduce the previous actions, but in a more condensed way to test the minimum upgrade steps.

Step 1 preconfig

git config --global url."https://github".insteadOf git://github
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

Step 2 database

  1. follow docs steps to create db and user
  2. export database from mongodb 6
    mongodump -u nodebb -p password -d nodebb -o .
  3. direct import data to mongodb 8
    mongorestore -d nodebb nodebb/ -v
  4. v1.12.2 self upgrade
    nvm version 12
    ./nodebb upgrade
  5. launch nodebb and uninstall all outdate plugins
    ./nodebb dev

Step 3 nodebb

  1. v1.12.2 -> v1.16.x
    nvm switch to 14
    git checkout v1.16.x
    git reset --hard origin/v1.16.x
    ./nodebb upgrade failed
/home/nodebb/nodebb/node_modules/yargs/build/index.cjs:2804
            if (shim$1.Parser.looksLikeNumber(arg) &&
                              ^

TypeError: shim$1.Parser.looksLikeNumber is not a function
    at Object.Yargs.self._parsePositionalNumbers (/home/nodebb/nodebb/node_modules/yargs/build/index.cjs:2804:31)
    at Object.Yargs.self._postProcess (/home/nodebb/nodebb/node_modules/yargs/build/index.cjs:2787:25)
    at Object.parseArgs [as _parseArgs] (/home/nodebb/nodebb/node_modules/yargs/build/index.cjs:2774:21)
    at Object.get [as argv] (/home/nodebb/nodebb/node_modules/yargs/build/index.cjs:2651:25)
    at exports.Argv.Argv.loadArgv (/home/nodebb/nodebb/node_modules/nconf/lib/nconf/stores/argv.js:75:16)
    at exports.Argv.Argv.loadSync (/home/nodebb/nodebb/node_modules/nconf/lib/nconf/stores/argv.js:54:8)
    at exports.Provider.Provider.add (/home/nodebb/nodebb/node_modules/nconf/lib/nconf/provider.js:136:23)
    at exports.Provider.Provider. [as argv] (/home/nodebb/nodebb/node_modules/nconf/lib/nconf/provider.js:36:21)
    at Object. (/home/nodebb/nodebb/src/cli/index.js:94:7)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)

still failed with nodebb-plugin-emoji-static plugin, success after npm uninstall and remove folder
npm i --verbose
./nodebb upgrade

  1. v1.16.x -> v2.x
    nvm switch to 18
    git checkout v2.x
    git reset --hard origin/v2.x
    ./nodebb upgrade success

  2. v2.x -> v3.x
    git checkout v3.x
    git reset --hard origin/v3.x
    ./nodebb upgrade success

  3. v3.x -> v4.x
    nvm switch to 22
    git checkout master
    git reset --hard origin/master
    ./nodebb upgrade success

Based on my testing, the main source of upgrade errors appears to be certain outdated plugins. The recommended procedure is to uninstall them via the ACP panel prior to upgrading, then manually uninstall them again with npm in the NodeBB directory and remove their folders from node_modules, and only then perform the upgrade.

First try

Step 1 database
The target machine has MongoDB 7 installed, not 8. To ensure no data errors occur, I will upgrade to version 8 later
First, dump database and restore
mongodump -u nodebb -p password -d nodebb -o database
mongodb auth been disabled while upgrading, so i can import data without auth
mongorestore -d nodebb nodebb/ -v

Step 2 upgrade nodebb

  • Force git to use HTTPS. This problem cost me hours trying to find a solution. https://stackoverflow.com/a/72391698
    git config --global url."https://github".insteadOf git://github

  • Disabling IPv6 for now. I'm experiencing issues accessing npmjs over IPv6
    sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
    sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

  • v1.12.2 -> v1.13.x/v1.14.x/v1.15.x failed
    nvm version 12, error on ./nodebb upgrade. The errors I'm seeing looks like compatibility issue between benchpress and Node.js version 12.

  • v1.12.2 -> v1.16.x success
    nvm switch to 14, some error on ./nodebb upgrade. The upgrade process had some errors, but the outcome wasn't impacted. Once completed, ./nodebb dev works.

  • v1.16.x -> v1.17.x -> v1.18.x -> v1.19.x success

  • v1.19.x -> v2.x success

  • v2.x -> v3.x failed

  • v2.x -> v3.0.1 success
    some error on ./nodebb upgrade. The upgrade process had some errors, but the outcome wasn't impacted. Once completed, ./nodebb dev works.

  • v3.0.1 -> v3.x failed

  • v2.x -> v3.x success
    nvm switch to 18. I removed a plugin that depended on a too-old markdown version, and then the upgrade completed successfully.

  • v3.x -> v4.x success
    nvm switch to 20. failed on v4.x branch, success after switch to origin/master git checkout master; git reset --hard origin/master