Hi, I want to report that I have the same error as the author of this topic. I just have started maintencance of NodeBB forum and I wanted to upgrade it to the newest version. I did every step from upgrade guide, but unfortunatelly error occurs when I was trying to update forum with "upgrade" command.
When I was searching solution to my problem I found this commit https://github.com/NodeBB/NodeBB/commit/6f1fb4eb246f035c329ff361ed2cf145e3936335 and this topic https://github.com/barisusakli/nodebb-plugin-dbsearch/issues/49
So everything pointed to added line "require('../../require-main');" as the cause of the problem (in file src/cli/index.js). I moved it to upgrade.js file, before the upgradePlugins require and everything works.