NodeJS 将web3导入到下一个js时出错

f87krz0w  于 2022-11-03  发布在  Node.js
关注(0)|答案(3)|浏览(162)

{"header":{"type":"auto_translation","ret_code":"error","time_cost":940.0,"request_id":"89286be15b8a11ed84167092def456c7"},"message":"Translation error (20001), please retry later. Detail: RuntimeException - The length of source sentence is too long!!! - {\n "header": {\n "time_cost": 0.000518,\n "type": "auto_translation",\n "ret_code": "The length of source sentence is too long!!!"\n }\n}"}

jbose2ul

jbose2ul1#

我认为这与最近的web31.8版本有关。至少我在Next.js中的无服务器函数中使用它时遇到了同样的问题。
降级1.7.4版就解决了这个问题。

npm install web3@1.7.4
fwzugrvs

fwzugrvs2#

对于任何面临这个问题的人,要么检查另一个关于使用另一个版本的web3的答案,要么使用ethers js. https://www.google.com/url?sa=t&source=web&cd=&ved=2ahUKEwiW9Yy-7Yf7AhV4gv0HHazMBt8QFnoECA0QAQ&url=https%3A%2F%2Fdocs.ethers.io%2Fv5%2F&usg=AOvVaw0K35ZXh2W0l39XPnBhIoxu

7fyelxc5

7fyelxc53#

如果你也把nextjs版本降级到12.3.0,web3js在1.8版本可以正常工作。我不知道为什么,但对我来说是有效的。干杯。

相关问题