TypeError: Path must be a string. Received undefined - when require a module.



  • No mater what i do, got the same error.

    cat test.js
    var nconf = require('nconf');
    nconf.file({file: "config.json"})
    var db = require('./src/database');
    db.init();
    var u = require('./src/user'); // This triggers the error

    $node test.js

    path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

    TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at module.exports (/home/user/webapps/nodebb/nodebb /src/meta/logs.js:11:14)
    at /home/user/webapps/nodebb/nodebb/src/meta.js:20:24
    at Object.<anonymous> (/home/user/webapps/nodebb/nodebb/src/meta.js:70:2)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

    Im using: nodeenv (1.0.0) inside vierualenv (15.0.3)
    NodeBB 1.4.0
    Node 6.0.0
    npm 3.8.6

    $node debug test.js

    break in module.js:419
    417   } finally {
    418     if (threw) {
    419       delete Module._cache[filename];
    420     }
    421   }
    

    I think i found the solution but don't know how to apply it.

    use node 5.x instead of node 6 // Tried it, same result.
    or
    add a key 'publicPath' to the webpack config output node
    output:{
    publicPath:''
    }

    I don't know where to add publicPath.


  • Global Moderator

    @MoJo we have tests for Node v6, it should work fine. Can you share some more info, please? Including the NodeBB version and what you're tryign to do.



  • This post is deleted!


  • This post is deleted!


  • This post is deleted!

Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.