On Fri, Jul 1, 2016 at 9:24 AM, Marco Stolle <marco.sto...@gmail.com> wrote: > Hello, > > i'm testing a library where i have to run the script with sudo, thats when i > get an error on the line > > var homedir =require('os').homedir() > > (i also get this error in a file with only this line, it's unrelated to the > library) > > this results in > > testhomedir.js:1 > > quire, module, __filename, __dirname) { var homedir = > require('os').homedir(); > > ^ > > TypeError: undefined is not a function > > at Object.<anonymous> (/home/marco/test/testhomedir.js:1:91) > > at Module._compile (module.js:460:26) > > at Object.Module._extensions..js (module.js:478:10) > > at Module.load (module.js:355:32) > > at Function.Module._load (module.js:310:12) > > at Function.Module.runMain (module.js:501:10) > > at startup (node.js:129:16) > > at node.js:814:3 > > > > on mac i don't have this problem on linux i do > > > any ideas?
Your Mac has a version of node.js installed that has os.homedir(), your Linux machine does not. Going by the line numbers in the stack trace, it's node.js v0.12. os.homedir() didn't appear until io.js v2.3.0. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAHQurc_3A_OqUncorKbVVDJi_kwkmJy12xzzrP-j3caOA6puGg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.