无法解析模块“ react-native-reanimated”

Pir*_*dul 5 react-native-android

一旦我使用以下命令安装了标签模块,React本机项目就可以正常运行而无需使用React Navigation标签模块

npm install --save react-navigation-tab

在节点终端上发生以下错误。

React-tab导航引发以下错误。

错误:捆绑失败:错误:无法解析模块react-native-reanimatednode_modules\react-navigation-tabs\lib\module\views\MaterialTopTabBar.js:反应母语-复活不能在项目中被发现。

小智 20

如果您正在与世博会合作

我遇到了完全相同的问题,这就是我所做的并且有效!

遵循入门指南

这基本上是安装反应导航所需的依赖项https://reactnavigation.org/docs/getting-started/

yarn add @react-navigation/native

expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view

然后我意识到这react-native-reanimated是在未满足的对等依赖项中,因此为了确保安装了正确的版本,您必须运行expo install react-native-reanimated

纱线警告

再试一次,就是这样!

PDTA...

我发现这一点是因为我删除了node_modules文件夹并再次安装了所有依赖项yarn install,因此,如果出现问题,这将是绝望的最后一次尝试。虽然我认为这没有必要。


che*_*nop 10

react-navigation-tabs取决于react-navigation软件包。
因此,我认为您错过了“ 入门”部分。

当前,对于react-navigation 4.x,您应该:

yarn add react-navigation
yarn add react-native-reanimated react-native-gesture-handler react-native-screens@^1.0.0-alpha.23
Run Code Online (Sandbox Code Playgroud)

然后针对ios:

cd ios
pod install
Run Code Online (Sandbox Code Playgroud)

要完成Android的react-native-screens的安装,请将以下两行添加到的依赖项部分android/app/build.gradle

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
Run Code Online (Sandbox Code Playgroud)


Lal*_*mar 9

我使用的是react-native 0.67版本

我按照以下步骤修复它

步骤 1. npm i react-native-reanimated

步骤2.添加插件babel.config.js

plugins: ['react-native-reanimated/plugin'],
Run Code Online (Sandbox Code Playgroud)

步骤 3 当关闭终端后尝试运行代码时,我仍然面临同样的问题

Error: Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?
Run Code Online (Sandbox Code Playgroud)

步骤 4. 之后,我关闭当前终端并运行此命令

npm start -- --reset-cache 
Run Code Online (Sandbox Code Playgroud)

现在问题已修复。