• 赚钱入口【需求资源】限时招募流量主、渠道主,站长合作;【合作模式】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 7个月前 (11-15) 149次浏览 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)

您必须 登录 才能发表评论!