【发布时间】:2018-12-30 21:07:19
【问题描述】:
我正在使用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)
感谢您的帮助
【问题讨论】:
-
嘿,我也面临同样的问题。你找到解决方案了吗?
-
有人找到解决方案了吗?仍然能够以 8 角重新生成
标签: node.js angular socket.io angular6 nodejs-stream