下载了完整webrtc代码后,node.js 报错,代码在同事机上能跑,我机子报错
PHP中文网
PHP中文网 2017-04-17 16:02:53
[Node.js讨论组]

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

                   ^

TypeError: this is not a typed array.

at Function.from (native)
at Object.<anonymous> (e:\work\untitled\自我学习\webRtc 实例(IM 通讯)\websocket\Nodejs-Websocket\node_modules\ws\lib\PerMessageDeflate.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:\work\untitled\自我学习\webRtc 实例(IM 通讯)\websocket\Nodejs-Websocket\node_modules\ws\lib\WebSocket.js:16:27)
at Module._compile (module.js:409:26)

Process finished with exit code 1

求问,如何解决这个问题,

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

PHP中文网
PHP中文网

认证高级PHP讲师

全部回复(1)
黄舟

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号