• 赚钱入口【需求资源】限时招募流量主、渠道主,站长合作;【合作模式】CPS长期分成,一次推广永久有收益。主动打款,不扣量;

Angular 6导入socket.io-stream后报错Can’t resolve ‘stream’ in ‘ ‘C:\Users\geoffroy\Documents\Mines Alès\2A\Stage\WebService based GUI\WebApp\node_modules\socket.io-stream\lib’

JavaScript cps12345 2周前 (11-15) 17次浏览 0个评论

npm install socket.io-stream安装

然后如下使用

import * as io from 'socket.io-client';
import * as ss from 'socket.io-stream';
stream=ss.createStream();

报错:

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'

解决

在polyfills.ts文件加入如下行

// Add global to window, assigning the value of window itself.

(window as any).global = window;

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址