[私人] T460p上运行orbit_js报ERR_NO_ICU的问题

T460p机器上代码运行到 require('autobahn') 段时报如下错误:

"fatal" option is not supported on Node.js compiled without ICU

但是在mac、L470上运行均无错误,开始以为是node版本引起,后更改版本发现无差别。

经各种搜索未果,在github-crossbario/autobahn上提问无人问津:

https://github.com/crossbario/autobahn-js/issues/478

Codes under work well some times before, but never worknow :
try { autobahn = require('autobahn'); } catch (e) { console.log("wamp_orbital.js.connectServer exception = " +e); return; }
Exception occurs:


wamp_orbital.js.connectServer exception = TypeError [ERR_NO_ICU]: "fatal" option is not supported on Node.js compiled without ICU


Since I didn't meet such errors before, and I didn't change any code, maybe there is some difference in node-version or Electron-version, but I forgot corrent ones.


node -v v12.10.0
electron 2.0.8


Anyone met the same problem as 

遂开始进入node_modules中打印调试。

首先发现,问题异常发生在autobahn.js(v-18.3.2)的代码行为:

var cbor = require('cbor');

遂进入cbor库(v-5.0.1)中查询,发现异常发生在代码行:

exports.Commented = require('./commented')

继续进入cbor同目录下的commented.js文件中查询,发现异常代码行:

const utils = require('./utils')

继续进入cbor同目录下的utils.js文件中查询,发现异常代码行:

const td = new TD('utf8', {fatal: true, ignoreBOM: true})

其中,打印发现:

const TD = (typeof TextDecoder === 'function') ? TextDecoder : util.TextDecoder

使用了util.TextDecoder。

后检测发现,在L470中,可以正常运行的cbor版本为v-4.0.0,尝试手动在T460p上安装v-4.0.0版本的cbor后,原来的ICU报错不见了,但是出现新的问题:

wamp_orbital.js.connectServer connection = [object Object]
could not create WAMP transport 'websocket':  browser does not support WebSocket or WebSocket in Web workers
could not create any WAMP transport

拷贝了一份L470下的完整node_moudles目录,运行时正常,开始尝试逐个替换测试:

1、autobahn

2、cbor

比对发现,autobahn中的Dockerfile有所区别:

L470可用版本中为 apt-get install -y npm nodejs-legacy
T460p中不可用版本为 apt-get install -y npm nodejs  nodejs-dev


L470: autobahn "version": "18.10.2"
T460p: autobahn "version": "18.3.2"

实际上在工程的package.json中,配置的autobahn版本为18.3.2,但是为何通过npm install自动安装了18.10.2版本呢?

手动安装autobahn 18.3.2版本得以解决问题:

npm install autobahn@18.3.2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Luppiter.W

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值