我无法安装socket.io而且我不知道为什么。当然安装了Node.js和npm。但是当我尝试通过npm安装socket.io时,我收到错误"找不到模块&has-unicode'"。
如果有人能帮助我的话会很棒。
这是完整的调试日志:
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 ]
答案 0 :(得分:0)
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.