geo*_*eux 5 node.js socket.io nodejs-stream angular angular6
我正在使用npm install socket.io-stream\n 我在我的角度组件上实现socket.io-stream如下所示:
import * as io from 'socket.io-client';\nimport * as ss from 'socket.io-stream';\nRun Code Online (Sandbox Code Playgroud)\n\n我只想创建一个像这样的双工流:
\n\nstream=ss.createStream();\nRun Code Online (Sandbox Code Playgroud)\n\n当我运行时出现此错误ng build:
ERROR in ./node_modules/socket.io-stream/lib/iostream.js\nModule not found: Error: Can't resolve 'stream' in ' \n'C:\\Users\\geoffroy\\Documents\\Mines Al\xc3\xa8s\\2A\\Stage\\WebService based \nGUI\\WebApp\\node_modules\\socket.io-stream\\lib'\nERROR in ./node_modules/socket.io-stream/lib/blob-read-stream.js\nModule not found: Error: Can't resolve 'stream' in \n'C:\\Users\\geoffroy\\Documents\\Mines Al\xc3\xa8s\\2A\\Stage\\WebService based \nGUI\\WebApp\\node_modules\\socket.io-stream\\lib'\nRun Code Online (Sandbox Code Playgroud)\n\n我不明白,因为在我的 server.js 上它似乎有效..
\n\n我尝试运行该命令npm install stream,但没有出现错误ng build。但是当我启动我的应用程序时,我的浏览器控制台中出现了一个新错误:
inherits_browser.js:5 Uncaught TypeError: Cannot read property 'prototype' of undefined\nat Object.inherits (inherits_browser.js:5)\nat Object../node_modules/socket.io-stream/lib/iostream.js (iostream.js:10)\nat __webpack_require__ (bootstrap:76)\nat Object../node_modules/socket.io-stream/lib/socket.js (socket.js:4)\nat __webpack_require__ (bootstrap:76)\nat Object../node_modules/socket.io-stream/lib/index.js (index.js:1)\nat __webpack_require__ (bootstrap:76)\nat Object../node_modules/socket.io-stream/index.js (index.js:2)\nat __webpack_require__ (bootstrap:76)\nRun Code Online (Sandbox Code Playgroud)\n\n感谢您的帮助
\n小智 1
只需在 polyfills.ts 中添加这一行
// Add global to window, assigning the value of window itself.
(window as any).global = window;
| 归档时间: |
|
| 查看次数: |
1352 次 |
| 最近记录: |