Error: Uncaught [TypeError: Cannot read property 'userAgent' of undefined] at reportException (D:\cnipa\node_modules\jsdom\lib\jsdom\living\helpers\runtime-script-errors.js:66:24) at Timeout.task [as _onTimeout] (D:\cnipa\node_modules\jsdom\lib\jsdom\browser\Window.js:521:9) at listOnTimeout (internal/timers.js:555:17) at processTimers (internal/timers.js:498:7) TypeError: Cannot read property 'userAgent' of undefined at _$VJ (eval at _$LN (http://epub.cnipa.gov.cn/gjcx.jsp:1:9116), <anonymous>:1:227500) at _$VJ (eval at _$LN (http://epub.cnipa.gov.cn/gjcx.jsp:1:9116), <anonymous>:1:250202) at _$VJ (eval at _$LN (http://epub.cnipa.gov.cn/gjcx.jsp:1:9116), <anonymous>:1:224959) at _$VJ (eval at _$LN (http://epub.cnipa.gov.cn/gjcx.jsp:1:9116), <anonymous>:1:248477) at _$XT (eval at _$LN (http://epub.cnipa.gov.cn/gjcx.jsp:1:9116), <anonymous>:1:262111) at _$jM (eval at _$LN (http://epub.cnipa.gov.cn/gjcx.jsp:1:9116), <anonymous>:1:207195) at Timeout.task [as _onTimeout] (D:\cnipa\node_modules\jsdom\lib\jsdom\browser\Window.js:516:19) at listOnTimeout (internal/timers.js:555:17) at processTimers (internal/timers.js:498:7)
大牛看了一下,说是jsdom代码报错,既然是代码报错,那就把这块代码注视掉吧,不让它报错了,省得去恶心人啊
找到 D:\cnipa\node_modules\jsdom\lib\jsdom\browser\Window.js,打开Window.js代码,找到516行,直接注视掉就可以了
把 handler.apply(methodContextProxy, args); 注释掉就可以了,如下图