您的位置:首页技术文章
文章详情页

下载了完整webrtc代码后,node.js 报错,代码在同事机上能跑,我机子报错

【字号: 日期:2023-10-03 15:48:33浏览:66作者:猪猪

问题描述

在 github上下载了别人的完整代码后,运行服务器,总是报错const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);

^

TypeError: this is not a typed array.

at Function.from (native)at Object.<anonymous> (e:workuntitled自我学习webRtc 实例(IM 通讯)websocketNodejs-Websocketnode_moduleswslibPerMessageDeflate.js:8:24)at Module._compile (module.js:409:26)at Object.Module._extensions..js (module.js:416:10)at Module.load (module.js:343:32)at Function.Module._load (module.js:300:12)at Module.require (module.js:353:17)at require (internal/module.js:12:17)at Object.<anonymous> (e:workuntitled自我学习webRtc 实例(IM 通讯)websocketNodejs-Websocketnode_moduleswslibWebSocket.js:16:27)at Module._compile (module.js:409:26)

Process finished with exit code 1下载了完整webrtc代码后,node.js 报错,代码在同事机上能跑,我机子报错求问,如何解决这个问题,

PS:代码在同事机子能跑,我机子失败,我是Win10, 他Win7 但是我不觉得是这个原因

问题解答

回答1:

Buffer.from()这个方法是在 node 6.0引入的 websocke 使用了该方法 so,解决方法是升级本机的 nodejs 版本到6.0+

标签: web