node需要安装webSocket模块出现的错误

我根据这篇博客https://blog.csdn.net/u014535295/article/details/99303890安装,执行npm install ws -g时,提示如下警告,

npm WARN [email protected] requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself

找了很多资料都没有解决,

继续往下输命令行:node websocket-relay.js supersecret 8081 8082,发现出现Cannot find module 'ws',意味着服务没有成功设置推送端口(8081)和web端拉流端口(8082),

后面尝试npm install ws,不要-g,虽然也出现了如下警告

node需要安装webSocket模块出现的错误_第1张图片

继续执行node websocket-relay.js supersecret 8081 8082语句,便可出现

综上所述,npm install ws便可执行node安装webSocket模块

你可能感兴趣的:(node需要安装webSocket模块出现的错误)