gpt4 book ai didi

android - chrome 错误中的 react-native 调试

转载 作者:行者123 更新时间:2023-11-29 01:14:44 25 4
gpt4 key购买 nike

我使用 react-native 开发 Android 应用程序。当应用程序运行时,我尝试从 react-native 开发人员菜单中选择 Debug in Chrome,然后应用程序崩溃,但在控制台中,我运行命令 react-native start我看到了错误:

Launching Dev Tools...
ERROR Wrong length!
RangeError: Wrong length!
at validateArrayBufferArguments (/Users/sergiigetman/IdeaProjects/mbc_kidsvod_client/node_modules/babel-polyfill/node_modules/core-js/modules/_typed-buffer.js:157:39)
at new ArrayBuffer (/Users/sergiigetman/IdeaProjects/mbc_kidsvod_client/node_modules/babel-polyfill/node_modules/core-js/modules/_typed-buffer.js:247:29)
at createUnsafeArrayBuffer (buffer.js:43:12)
at createUnsafeBuffer (buffer.js:37:25)
at allocate (buffer.js:199:12)
at Function.Buffer.allocUnsafe (buffer.js:162:10)
at new Buffer (buffer.js:93:19)
at BufferPool.reset (/Users/sergiigetman/IdeaProjects/mbc_kidsvod_client/node_modules/ws/lib/BufferPool.js:57:26)
at Receiver.endPacket (/Users/sergiigetman/IdeaProjects/mbc_kidsvod_client/node_modules/ws/lib/Receiver.js:247:68)
at Receiver.finish (/Users/sergiigetman/IdeaProjects/mbc_kidsvod_client/node_modules/ws/lib/Receiver.js:483:12)

在堆栈和互联网上没有发现任何类似的问题。

最佳答案

我已经能够重现这个错误,这似乎是一个边缘案例,因为使用 babel-polyfill 版本 6.16.0 运行旧版本的 React Native (0.22.x)。该错误不会发生在当前版本的 React Native (0.40.0) 和 Babel Polyfill (6.20.0) 上。我们认为它不相关,但我们正在运行节点 7.2.0。

如果您无法更新您的环境,一个临时解决方法是编辑“babel-polyfill/node_modules/core-js/modules/_typed-buffer.js”并修改该文件第 157 行和第 175 行的缓冲区检查:

if(numberLength != byteLength)throw RangeError(WRONG_LENGTH);

如果你运行的是 babel-polyfill 6.20.0 那么你的文件将在这里:

node_modules/core-js/modules/_typed-buffer.js

我们已经能够通过评论这段长度检查来让我们的开发环境正常工作,但买者自负,您可能不希望将其投入生产。

关于android - chrome 错误中的 react-native 调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40586411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com