TypeError:pna.nextTick不是在angular 7中使用简单对等的函数
我在TypeError:pna.nextTick不是在angular 7中使用简单对等的函数,angular,angular6,webrtc,simple-peer,Angular,Angular6,Webrtc,Simple Peer,我在angular 7 async ngOnInit() { try { if (location.hash === '#init') { this.peer = new SimplePeer({ initiator: location.hash === '#init' }) } else { this.peer = new SimplePeer() } th
angular 7
async ngOnInit() {
try {
if (location.hash === '#init') {
this.peer = new SimplePeer({
initiator: location.hash === '#init'
})
}
else {
this.peer = new SimplePeer()
}
this.peer.on('signal', function (data) {
console.log(JSON.stringify(data));
})
this.peer.on('data', (data) => {
console.log('Received Data: ' + data)
})
} catch (error) {
console.log(error)
}
}
当angular compiler启动此事件时
this.peer.on('data', (data) => {
console.log('Received Data: ' + data)
})
然后它抛出错误
当我忽略此事件时
此错误消失
注意:软件包版本如下
simple peer v9.1.2
NPM v6.5.0
节点v10.14.2
解决了完全相同的问题:
npm i -S process, then add this to polyfill.ts:
import * as process from 'process';
window['process'] = process;
也可安装:
npm i -S process-nextick-args
问题似乎出在节点版本上,哪个节点版本?@FatemeFazli
node v10.14.2
因此请尝试$n lts
然后$npm install-g npm
然后$n stable
@FatemeFazli在windows
上工作,$
无法识别DDON没有类型$
只是n lts
然后npm安装-g npm
然后n稳定