Socket.io 安装抛出缺少必需的参数错误

时间:2021-03-28 05:33:24

标签: node.js npm socket.io

我正在运行一个 socke.io 应用程序,但在我之前的服务器中一切正常。但现在我在我的新 ubuntu 服务器上运行,它来自 Digitalocean。

问题是 错误:找不到模块“socket.io” 然后我尝试使用命令安装 socket.io。

npm install -g socket.io

但它给了我这样的错误:

npm ERR! Linux 4.15.0-140-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "socket.io"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:190:5
npm ERR! typeerror     at /usr/share/npm/node_modules/slide/lib/async-map.js:52:35
npm ERR! typeerror     at Array.forEach (<anonymous>)
npm ERR! typeerror     at /usr/share/npm/node_modules/slide/lib/async-map.js:52:11
npm ERR! typeerror     at Array.forEach (<anonymous>)
npm ERR! typeerror     at asyncMap (/usr/share/npm/node_modules/slide/lib/async-map.js:51:8)
npm ERR! typeerror     at exports.loadRequestedDeps (/usr/share/npm/lib/install/deps.js:188:3)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/mysite.com/socket/npm-debug.log

这是我的配置

Ubuntu:20.04 NPM 版本:v3.5.2,节点版本:v8.10.0

如何解决这个问题并安装 socket.io?

谢谢

1 个答案:

答案 0 :(得分:1)

我终于修好了:)

低于修复

npm install -g npm@3.10.10