微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

安装react-native-unimodules后编译React Native应用时出错

如何解决安装react-native-unimodules后编译React Native应用时出错

这是我的第一个没有Expo的React Native项目,因为我正在使用react-native-firebase,并且我知道无法在Expo中使用它。但是,我希望通过使用Expo的Bare Workflow来使用我现在熟悉的几个Expo模块。为此,我显然需要安装react-native-unimodules,这是通过遵循installation guide来完成的。

但是我似乎无法正常工作。完成安装步骤并尝试运行该应用程序(在iOS模拟器或android模拟器上)后,或者如果我只是尝试编译bundle.js,我将收到以下错误消息:

error ▶︎ Failed to compile.
error ▶︎ ./node_modules/expo-asset/build/PlatformUtils.js 12:37
Module parse Failed: Unexpected token (12:37)
You may need an appropriate loader to handle this file type,currently no loaders 
are configured to process this file. See https://webpack.js.org/concepts#loaders
| // local assets available.
| export const IS_BARE_ENV_WITH_UPDATES = !IS_MANAGED_ENV &&
>     !!NativeModulesProxy.ExpoUpdates?.isEnabled &&
|     // if expo-updates is installed but we're running directly from the 
embedded bundle,we don't want
|     // to override the AssetSourceResolver
 @ ./node_modules/expo-asset/build/Asset.js 7:0-77 58:17-44 145:38-51
 @ ./node_modules/expo-asset/build/index.js
 @ ./node_modules/react-native-unimodules/build/index.js
 @ ./src/App.tsx
 @ ./index.js
 @ multi ./node_modules/react-native/Libraries/polyfills/console.js
./node_modules/react-native/Libraries/polyfills/error-guard.js
./node_modules/react-native/Libraries/polyfills/Object.es7.js
react-native/Libraries/Core/InitializeCore.js ./index
./node_modules/expo-asset/build/EmbeddedAssets.js 13:44

我尝试确保所有模块/吊舱都是最新的,清除并重新安装我能想到的所有组件,但无济于事。我不确定从哪里开始寻找调试此问题的方法。有什么想法吗?

更新:我正在使用Haul进行捆绑-这似乎是导致问题的原因。如果我回过头来使用本机cli,它会起作用

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。