Setting up a local environment of nodebb causes some weird errors from dbsearch

Technical Support
  • #1

    I'm installing nodebb just fine, however when I enable nodebb-plugin-dbsearch, it says my NodeBB schema is out of date and I need to update it with nodebb upgrade. Sure no problem, however when I run the upgrade command it spits out an error saying Error: Cannot find module './database'. Uhh, what? I've deleted everything (and dropped the db) several times without luck.
    Output: https://pastebin.com/kqMvCeH1
    Look at line 42.
    Am on Windows 10, using mongo.

  • #4

    @PitaJ I think you fucked up, clean pull from master...

    D:\dev\nodebb\NodeBB>.\nodebb setup
    internal/modules/cjs/loader.js:583
        throw err;
        ^
    
    Error: Cannot find module './package-install'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
        at Function.Module._load (internal/modules/cjs/loader.js:507:25)
        at Module.require (internal/modules/cjs/loader.js:637:17)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Module.require.main.require (D:\dev\nodebb\NodeBB\require-main.js:8:10)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Object.<anonymous> (D:\dev\nodebb\NodeBB\src\cli\index.js:8:22)
        at Module._compile (internal/modules/cjs/loader.js:689:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
        at Module.load (internal/modules/cjs/loader.js:599:32)
    

    EDIT:
    I rearranged the requires so the require('../../require-main'); is last:

    var fs = require('fs');
    var path = require('path');
    
    var packageInstall = require('./package-install');
    var dirname = require('./paths').baseDir;
    
    require('../../require-main');
    

    Seems to work.

    EDIT2:
    maybe not

    Dependencies outdated or not yet installed.
    Installing them now...
    
    audited 4313 packages in 7.307s
    found 5 vulnerabilities (1 low, 4 moderate)
      run `npm audit fix` to fix them, or `npm audit` for details
    OK
    
    internal/modules/cjs/loader.js:583
        throw err;
        ^
    
    Error: Cannot find module '../../package.json'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
        at Function.Module._load (internal/modules/cjs/loader.js:507:25)
        at Module.require (internal/modules/cjs/loader.js:637:17)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Module.require.main.require (D:\dev\nodebb\NodeBB\require-main.js:8:10)
        at require (internal/modules/cjs/helpers.js:22:18)
        at Object.<anonymous> (D:\dev\nodebb\NodeBB\src\cli\index.js:75:11)
        at Module._compile (internal/modules/cjs/loader.js:689:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
        at Module.load (internal/modules/cjs/loader.js:599:32)
    
  • Global Moderator Plugin & Theme Dev
    #5

    I'm almost certain it's something wrong on your end.

  • Global Moderator Plugin & Theme Dev
    #6

    Those error messages don't make sense. What are the steps you're taking to install?

    Errors like that would definitely be picked up by the CI tests, and they're passing.

    The order of that module require shouldn't make any difference at all.

  • #7

    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.

  • Global Moderator Plugin & Theme Dev
    #8

    I don't think that commit has been released yet, which would explain why you'd still have the error. You could have just cherry-picked that commit you linked, but what you did works as well. It might just end up conflicting with future upgrades.


Suggested Topics


| | | |