您的位置:首頁技術文章
文章詳情頁

下載了完整webrtc代碼后,node.js 報錯,代碼在同事機上能跑,我機子報錯

瀏覽:100日期:2023-10-03 15:48:33

問題描述

在 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
国产综合久久一区二区三区