我正在使用npm install socket.io-stream
我socket.io-stream
在我的角度组件上实现,如下所示:
import * as io from 'socket.io-client';
import * as ss from 'socket.io-stream';
我只想像这样创建一个双工流:
stream=ss.createStream();
运行时出现此错误ng build
:
ERROR in ./node_modules/socket.io-stream/lib/iostream.js
Module not found: Error: Can't resolve 'stream' in '
'C:\Users\geoffroy\Documents\Mines Alès\2A\Stage\WebService based
GUI\WebApp\node_modules\socket.io-stream\lib'
ERROR in ./node_modules/socket.io-stream/lib/blob-read-stream.js
Module not found: Error: Can't resolve 'stream' in
'C:\Users\geoffroy\Documents\Mines Alès\2A\Stage\WebService based
GUI\WebApp\node_modules\socket.io-stream\lib'
我不明白,因为在我的 server.js 上它似乎工作..
我尝试运行该命令npm install stream
,但没有错误ng build
。但是当我启动我的应用程序时,我的浏览器控制台中出现了一个新错误:
inherits_browser.js:5 Uncaught TypeError: Cannot read property 'prototype' of undefined
at Object.inherits (inherits_browser.js:5)
at Object../node_modules/socket.io-stream/lib/iostream.js (iostream.js:10)
at __webpack_require__ (bootstrap:76)
at Object../node_modules/socket.io-stream/lib/socket.js (socket.js:4)
at __webpack_require__ (bootstrap:76)
at Object../node_modules/socket.io-stream/lib/index.js (index.js:1)
at __webpack_require__ (bootstrap:76)
at Object../node_modules/socket.io-stream/index.js (index.js:2)
at __webpack_require__ (bootstrap:76)
谢谢你的帮助