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

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

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引入了没有使用第二天过来运行报错

解决方法

引入注释掉就可以了

A module that was compiled using NumPy 1.x cannot be run in NumPy 2.0.2 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'. If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2. Traceback (most recent call last): File "/emotion-recogniton-pytorch-orangepiaipro-main/train_emotion_classifier.py", line 2, in <module> import torch File "/usr/local/miniconda3/lib/python3.9/site-packages/torch/__init__.py", line 1382, in <module> from .functional import * # noqa: F403 File "/usr/local/miniconda3/lib/python3.9/site-packages/torch/functional.py", line 7, in <module> import torch.nn.functional as F File "/usr/local/miniconda3/lib/python3.9/site-packages/torch/nn/__init__.py", line 1, in <module> from .modules import * # noqa: F403 File "/usr/local/miniconda3/lib/python3.9/site-packages/torch/nn/modules/__init__.py", line 35, in <module> from .transformer import TransformerEncoder, TransformerDecoder, \ File "/usr/local/miniconda3/lib/python3.9/site-packages/torch/nn/modules/transformer.py", line 20, in <module> device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), /usr/local/miniconda3/lib/python3.9/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:84.) device: torch.device = torch.device(torch._C._get_default_device()), # torch.device('cpu'), Traceback (most recent call last): File "/emotion-recogniton-pytorch-orangepiaipro-main/train_emotion_classifier.py", line 6, in <module> from torchvision import transforms File "/usr/local/miniconda3/lib/python3.9/site-packages/torchvision/__init__.py", line 6, in <module> from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils File "/usr/local/miniconda3/lib/python3.9/site-packages/torchvision/models/__init__.py", line 2, in <module> from .convnext import * File "/usr/local/miniconda3/lib/python3.9/site-packages/torchvision/models/convnext.py", line 8, in <module> from ..ops.misc import Conv2dNormActivation, Permute File "/usr/local/miniconda3/lib/python3.9/site-packages/torchvision/ops/__init__.py", line 1, in <module> from ._register_onnx_ops import _register_custom_op File "/usr/local/miniconda3/lib/python3.9/site-packages/torchvision/ops/_register_onnx_ops.py", line 5, in <module> from torch.onnx import symbolic_opset11 as opset11 File "/usr/local/miniconda3/lib/python3.9/site-packages/torch/onnx/__init__.py", line 57, in <module> from ._internal.onnxruntime import ( File "/usr/local/miniconda3/lib/python3.9/site-packages/torch/onnx/_internal/onnxruntime.py", line 34, in <module> import onnx File "/home/HwHiAiUser/.local/lib/python3.9/site-packages/onnx/__init__.py", line 11, in <module> from onnx.external_data_helper import load_external_data_for_model, write_external_data_tensors, convert_model_to_external_data File "/home/HwHiAiUser/.local/lib/python3.9/site-packages/onnx/external_data_helper.py", line 14, in <module> from .onnx_pb import TensorProto, ModelProto File "/home/HwHiAiUser/.local/lib/python3.9/site-packages/onnx/onnx_pb.py", line 8, in <module> from .onnx_ml_pb2 import * # noqa File "/home/HwHiAiUser/.local/lib/python3.9/site-packages/onnx/onnx_ml_pb2.py", line 33, in <module> _descriptor.EnumValueDescriptor( File "/usr/local/miniconda3/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 789, 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). More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
05-15
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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

An_s

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

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

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

打赏作者

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

抵扣说明:

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

余额充值