On OSX, I need to use macports, because I run into issues with Brew. I uninstalled homebrew package manager and tried to get node to work:
I do a clean install of nodejs and npm
sudo port install nodejs npm
Let's just show that there is only npm installed, and no other modules.
$ ls /opt/local/lib/node_modules/
npm
Trying to get a node package working, testing with appdmg
sudo npm install -g appdmg
Now here's the cryptic error. (NOTE: It worked with brew
's version of NPM, earlier this morning)
$ appdmg
module.js:460
return process.dlopen(module, path._makeLong(filename));
^
Error: Module version mismatch. Expected 46, got 47.
at Error (native)
at Object.Module._extensions..node (module.js:460:18)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/appdmg/node_modules/macos-alias/lib/create.js:7:13)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
I'm using 10.8.4 Mountain Lion. I tried with the latest version of node (5.1), and the older version (4.2) and got INVERSE results..
On 5.1, the message reads:
Error: Module version mismatch. Expected 47, got 46.
On 4.2.2 I got
Error: Module version mismatch. Expected 46, got 47.
Which lead me to believe there was some lingering brew version of node. So (after installing node via the node osx packager installation on the main website, not sure if that matters) I ran this uninstall script and it fixed it, thanks to @nicerobot via https://gist.github.com/nicerobot/2697848:
curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh
chmod +x ./uninstall-node.sh
./uninstall-node.sh
rm uninstall-node.sh