REACT-NATIVE无法在Android上构建:无法解决提升-非REACTION-STATIC&39; [英] react-native fails to build on Android: can't resolve 'hoist-non-react-statics'

查看:32
本文介绍了REACT-NATIVE无法在Android上构建:无法解决提升-非REACTION-STATIC&39;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它可以在web上运行,但当我尝试在Android上运行它时,收到以下错误:

Android Bundling failed 1275ms
While trying to resolve module `hoist-non-react-statics` from file `/PROJECTPATH/node_modules/react-native-gesture-handler/src/gestureHandlerRootHOC.tsx`, the package `/PROJECTPATH/node_modules/hoist-non-react-statics/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/PROJECTPATH/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js`. Indeed, none of these files exist:

* /PROJECTPATH/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
  * /home/esd/Documents/pro/bunnymoney/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
我还清除了我的Metro缓存(npm start--set-cache),重新安装了所有节点模块(删除node_module文件夹并运行‘npm install’),并且最初清除了Watchman(Watchman watch-del-all),它找不到模块,但我安装了它,我现在不知道该怎么办。以下是我的项目依赖项:


    "@react-navigation/native": "^6.0.6",
    "@react-navigation/native-stack": "^6.2.5",
    "expo": "~43.0.2",
    "expo-splash-screen": "~0.13.5",
    "expo-status-bar": "^1.1.0",
    "expo-updates": "~0.10.13",
    "hoist-non-react-statics": "^3.3.2",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-native": "0.64.3",
    "react-native-gesture-handler": "~1.10.2",
    "react-native-reanimated": "~2.2.0",
    "react-native-safe-area-context": "3.3.2",
    "react-native-screens": "~3.8.0",
    "react-native-web": "0.17.1"

推荐答案

在您的项目中搜索从&QOOT;HOIST-Non-REACTION-STATIC&QOOT;的任何导入-您很可能会发现,您的自动导入是从那里导入的useEffectuseState等,而不是从&QOOT;REACTION&QOOT;本身导入的。

看起来您使用的不是TypeScript,但导致此问题的特定版本最近出现了问题。

您不需要";hoist-non-reaction-static";,因此完成上述操作后,您可以随时将其作为依赖项删除。

这篇关于REACT-NATIVE无法在Android上构建:无法解决提升-非REACTION-STATIC&39;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆