Expo开发React Native应用启动报NSRangeException,调试无效求助
我的app.js代码如下:
//app.js import React from 'react'; import AppNavigator from './src/navigation/AppNavigator'; import { Provider as PaperProvider } from 'react-native-paper'; import lightRedColors from '../BaseApp/src/theme/farbe/lightRedColors' export default function App() { return ( <PaperProvider theme={lightRedColors}> <AppNavigator /> </PaperProvider> ); }
即使移除<AppNavigator />组件,错误仍然存在。
遇到的错误信息:
NSRangeException: *** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array
调用栈:
RCTFatalException
facebook::react::RCTNativeModule::callSerializableNativeHook(unsigned int, folly::dynamic&&)
facebook::react::RCTNativeModule::callSerializableNativeHook(unsigned int, folly::dynamic&&)
facebook::react::JSIExecutor::nativeCallSyncHook(facebook::jsi::Value const*, unsigned long)
non-virtual thunk to reanimated::ReanimatedHermesRuntime::~ReanimatedHermesRuntime()
std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) const
facebook::hermes::HermesRuntimeImpl::HFContext::func(void*, hermes::vm::Runtime&, hermes::vm::NativeArgs)
hermes::vm::NativeFunction::_nativeCall(hermes::vm::NativeFunction*, hermes::vm::Runtime&)
hermes::vm::Interpreter::handleCallSlowPath(hermes::vm::Runtime&, hermes::vm::PinnedHermesValue*)
hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&)
hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*)
hermes::vm::Runtime::runBytecode(std::__1::shared_ptrhermes::hbc::BCProviderBase&&, hermes::vm::RuntimeModuleFlags, llvh::StringRef, hermes::vm::Handlehermes::vm::Environment, hermes::vm::Handlehermes::vm::HermesValue)
facebook::hermes::HermesRuntimeImpl::evaluatePreparedJavaScript(std::__1::shared_ptr<facebook::jsi::PreparedJavaScript const> const&)
facebook::hermes::HermesRuntime::evaluateJavaScriptWithSourceMap(std::__1::shared_ptr<facebook::jsi::Buffer const> const&, std::__1::shared_ptr<facebook::jsi::Buffer const> const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)
facebook::hermes::HermesRuntimeImpl::evaluateJavaScript(std::__1::shared_ptr<facebook::jsi::Buffer const> const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)
facebook::react::HermesExecutor::HermesExecutor(std::__1::shared_ptrfacebook::jsi::Runtime, std::__1::shared_ptrfacebook::react::ExecutorDelegate, std::__1::shared_ptrfacebook::react::MessageQueueThread, std::__1::function<void (std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > ()>)> const&, std::__1::function<void (facebook::jsi::Runtime&)>)
facebook::react::JSIExecutor::loadBundle(std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const>>, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)
facebook::react::NativeToJsBridge::getDecoratedNativeMethodCallInvoker(std::__1::shared_ptrfacebook::react::NativeMethodCallInvoker) const
facebook::react::NativeToJsBridge::getDecoratedNativeMethodCallInvoker(std::__1::shared_ptrfacebook::react::NativeMethodCallInvoker) const
facebook::react::tryAndReturnError(std::__1::function<void ()> const&)
facebook::react::RCTMessageThread::tryFunc(std::__1::function<void ()> const&)
facebook::react::RCTMessageThread::runAsync(std::__1::function<void ()>)
5A6C1F41-BF70-32F6-A1D6-5B894DD21362
5A6C1F41-BF70-32F6-A1D6-5B894DD21362
5A6C1F41-BF70-32F6-A1D6-5B894DD21362
CFRunLoopRunSpecific
RCTConvertArrayValue
5623831D-5719-33A9-9691-759F47D714D1
_pthread_start
thread_start
尝试过调试但无法定位错误,咨询ChatGPT和Gemini也没能解决。目前应用仅在启动时弹出该错误提示,功能无其他异常,求解决。
内容的提问来源于stack exchange,提问作者Nick

