RN启动报错[Workarounds] Packager unable to resolve module from /Users/node_modules/

博客围绕React Native中无法解析`AccessibilityInfo`模块的问题展开。给出了相关GitHub链接,列举了通用解决办法,如清除watchman watches、删除`node_modules`等。作者自身情况是安装运行正常,引入`react-navigation`未使用,次日运行报错,注释引入后问题解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

github:https://github.com/facebook/react-native/issues/4968

也在说这问题

Unable to resolve module `AccessibilityInfo` from `xxx\node_modules\react-native\Libraries\
react-native\react-native-implementation.js`: Module does not exist in the module map This might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the following: 1. Clear watchman watches: `watchman watch-del-all`. 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`. 3. Reset Metro Bundler cache: `rm -rf $TMPDIR/react-*` or `npm start -- --reset-cache`. 4. Remove haste cache: `rm -rf $TMPDIR/haste-map-react-native-packager-*`.

 

我的情况是这样的,安装运行没有问题然后开始写代码,第二天打开,报错看提示说要删node_modules等等操作

我个人推测的原因:

我把react-navigation引入了没有使用第二天过来运行报错

解决方法

引入注释掉就可以了

Traceback (most recent call last): File "/home/xianbei/CNN-VehicleType/test_vehicle_type.py", line 17, in <module> from keras.preprocessing.image import img_to_array File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/keras/__init__.py", line 3, in <module> from keras import __internal__ File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/keras/__internal__/__init__.py", line 3, in <module> from keras.__internal__ import backend File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/keras/__internal__/backend/__init__.py", line 3, in <module> from keras.src.backend import _initialize_variables as initialize_variables File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/keras/src/__init__.py", line 21, in <module> from keras.src import applications File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/keras/src/applications/__init__.py", line 18, in <module> from keras.src.applications.convnext import ConvNeXtBase File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/keras/src/applications/convnext.py", line 26, in <module> import tensorflow.compat.v2 as tf File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module> from tensorflow.python.tools import module_util as _module_util File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 53, in <module> from tensorflow.core.framework.graph_pb2 import * File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module> from tensorflow.core.framework import function_pb2 as tensorflow_dot_core_dot_framework_dot_function__pb2 File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/core/framework/function_pb2.py", line 16, in <module> from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2 File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module> from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2 File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module> from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2 File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 16, in <module> from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2 File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 36, in <module> _descriptor.FieldDescriptor( File "/home/xianbei/anaconda3/envs/py38/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 621, in __new__ _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
最新发布
07-03
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-35-b42d4f2a0683> in <module> 1 import pandas as pd 2 import numpy as np ----> 3 import tensorflow as tf 4 5 # 1. 加载CSV文件(针对指定路径) /usr/local/lib/python3.7/site-packages/tensorflow/__init__.py in <module> 22 23 # pylint: disable=g-bad-import-order ---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import 25 26 from tensorflow._api.v1 import app /usr/local/lib/python3.7/site-packages/tensorflow/python/__init__.py in <module> 50 51 # Protocol buffers ---> 52 from tensorflow.core.framework.graph_pb2 import * 53 from tensorflow.core.framework.node_def_pb2 import * 54 from tensorflow.core.framework.summary_pb2 import * /usr/local/lib/python3.7/site-packages/tensorflow/core/framework/graph_pb2.py in <module> 13 14 ---> 15 from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2 16 from tensorflow.core.framework import function_pb2 as tensorflow_dot_core_dot_framework_dot_function__pb2 17 from tensorflow.core.framework import versions_pb2 as tensorflow_dot_core_dot_framework_dot_versions__pb2 /usr/local/lib/python3.7/site-packages/tensorflow/core/framework/node_def_pb2.py in <module> 13 14 ---> 15 from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2 16 17 /usr/local/lib/python3.7/site-packages/tensorflow/core/framework/attr_value_pb2.py in <module> 13 14 ---> 15 from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2 16 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2 17 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2 /usr/local/lib/python3.7/site-packages/tensorflow/core/framework/tensor_pb2.py in <module> 13 14 ---> 15 from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2 16 from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2 17 from tensorflow.core.framework import types_pb2 as tensorflow_dot_core_dot_framework_dot_types__pb2 /usr/local/lib/python3.7/site-packages/tensorflow/core/framework/resource_handle_pb2.py in <module> 39 message_type=None, enum_type=None, containing_type=None, 40 is_extension=False, extension_scope=None, ---> 41 serialized_options=None, file=DESCRIPTOR), 42 _descriptor.FieldDescriptor( 43 name='container', full_name='tensorflow.ResourceHandleProto.container', index=1, /usr/local/lib/python3.7/site-packages/google/protobuf/descriptor.py in __new__(cls, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options, serialized_options, has_default_value, containing_oneof, json_name, file, create_key) 559 has_default_value=True, containing_oneof=None, json_name=None, 560 file=None, create_key=None): # pylint: disable=redefined-builtin --> 561 _message.Message._CheckCalledFromGeneratedFile() 562 if is_extension: 563 return _message.default_pool.FindExtensionByName(full_name) TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower). More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
06-09
(ray_fix) (base) dwh@dwh:~$ /home/dwh/anaconda3/envs/ray_fix/bin/python3.7 /home/dwh/metadrive/metadrive/examples/metadrivedate.py Traceback (most recent call last): File "/home/dwh/metadrive/metadrive/examples/metadrivedate.py", line 1, in <module> import ray File "/home/dwh/anaconda3/envs/ray_fix/lib/python3.7/site-packages/ray/__init__.py", line 91, in <module> import ray._raylet # noqa: E402 File "python/ray/_raylet.pyx", line 104, in init ray._raylet File "/home/dwh/anaconda3/envs/ray_fix/lib/python3.7/site-packages/ray/exceptions.py", line 5, in <module> from ray.core.generated.common_pb2 import RayException, Language, PYTHON File "/home/dwh/anaconda3/envs/ray_fix/lib/python3.7/site-packages/ray/core/generated/common_pb2.py", line 37, in <module> create_key=_descriptor._internal_create_key), File "/home/dwh/anaconda3/envs/ray_fix/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 796, in __new__ _message.Message._CheckCalledFromGeneratedFile() TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are: 1. Downgrade the protobuf package to 3.20.x or lower. 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower). More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
04-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

An_s

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

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

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

打赏作者

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

抵扣说明:

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

余额充值