Search code examples
node.jsnpmnodeunit

Error: Cannot find module '../deps/console.log'


I'm on OS X 10.8.2, with Node.js 0.10.0 installed via homebrew. When I try to run npm test on nodegit, I get the following error:

cd test && nodeunit *.js

module.js:340
    throw err;
          ^
Error: Cannot find module '../deps/console.log'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/.bin/nodeunit:11:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

I've done npm update && npm -g update since installing node 0.10.0.

How might I go about fixing this?


Solution

  • The stack trace says it all, it's an issue with nodeunit. I'd file an issue on their issues page.

    Not knowing much about nodeunit, it looks like it's anticipating being run from a different location. It's trying to require the file /Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/deps/console.log.js which is (probably) actually located at /Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/nodeunit/deps/console.log.js.