是的,我也出现了这个问题,不能import,storage这个包,只要一import,react native就会报错!

我重新安装了2.版本就可以运行,但是安装最新版本仍然是报错如下:
While trying to resolve module leancloud-storage from file , the package node_modules/leancloud-storage/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (node_modules/leancloud-storage/dist/av-rn-min.js. Indeed, none of these files exist:

  • node_modules/leancloud-storage/dist/av-rn-min.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
  • node_modules/leancloud-storage/dist/av-rn-min.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)

看下 @leancloud/platform-adapters-react-native 是否加入了项目依赖?

参见 文档5

AV 必须从 "leancloud-storage/core" 中引入,并且配合 @leancloud/platform-adapters-react-native 一起使用。

您好!我按着您的方法试了,现在的报错变成了这样,我也多次删除node_modules 移除package中的dependency再install,还是没有解决,请问这是什么问题呢,谢谢!

The package at "node_modules/leancloud-storage/dist/cjs/file.js" attempted to import the Node standard library module "stream". It failed because React Native does not include the Node standard library. Read more at https://docs.expo.io/versions/latest/introduction/faq/#can-i-use-nodejs-packages-with-expo3

麻烦提供下 React Native 的版本号,我们调查一下。

React Naitve 的支持已在 4.6.0 中修复。需要注意因新版使用了 @react-native-community/async-storage 代替了已废弃的内置 AsyncStorage,因此有一个额外的 link 步骤,具体请参考最新文档。