sln sln - 5 months ago 17
Node.js Question

Why I can't install socket.io?

I can't install socket.io and I don't know why. Node.js and npm are certainly installed. But when I try to install socket.io via npm, I get the error "Cannot find module 'has-unicode'".

It would be great, if anyone could help me.

This is the full debug log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'socket.io' ]
2 info using npm@2.15.5
3 info using node@v4.4.5
4 verbose config Skipping project config: /Users/sollom/.npmrc. (matches userconfig)
5 verbose stack Error: Cannot find module 'has-unicode'
5 verbose stack at Function.Module._resolveFilename (module.js:325:15)
5 verbose stack at Function.Module._load (module.js:276:25)
5 verbose stack at Module.require (module.js:353:17)
5 verbose stack at require (internal/module.js:12:17)
5 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-install-checks/node_modules/npmlog/node_modules/gauge/progress-bar.js:2:18)
5 verbose stack at Module._compile (module.js:409:26)
5 verbose stack at Object.Module._extensions..js (module.js:416:10)
5 verbose stack at Module.load (module.js:343:32)
5 verbose stack at Function.Module._load (module.js:300:12)
5 verbose stack at Module.require (module.js:353:17)
5 verbose stack at require (internal/module.js:12:17)
6 verbose cwd /Users/sollom
7 error Darwin 15.4.0
8 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "socket.io"
9 error node v4.4.5
10 error npm v2.15.5
11 error code MODULE_NOT_FOUND
12 error Cannot find module 'has-unicode'
13 error If you need help, you may report this error at:
13 error <https://github.com/npm/npm/issues>
14 verbose exit [ 1, true ]

Answer

There might be an issue with OSX. Try to delete /usr/local/lib/node_modules and reinstall node. That should help. Here is a reference: https://github.com/npm/npm/issues/10454.