You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native项目报错:找不到react-native-reanimated/plugin模块求助

解决"找不到模块'react-native-reanimated/plugin'"的办法

1. 安装/重装react-native-reanimated

先检查项目根目录的package.json,确认是否存在react-native-reanimated依赖。如果没有,执行安装命令:

# npm
npm install react-native-reanimated --save-dev

# yarn
yarn add react-native-reanimated --dev

如果已存在该依赖,先卸载再重装,确保依赖文件完整:

# npm
npm uninstall react-native-reanimated && npm install react-native-reanimated --save-dev

# yarn
yarn remove react-native-reanimated && yarn add react-native-reanimated --dev

2. 修正Babel配置

打开项目根目录的babel.config.js(或.babelrc),确保插件配置正确,且react-native-reanimated/plugin放在plugins数组的最后一位:

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    // 其他插件
    'react-native-reanimated/plugin',
  ],
};

3. 清除缓存并重启服务

执行命令清除Metro缓存,再重启项目服务:

# npm
npm start -- --reset-cache

# yarn
yarn start --reset-cache

4. 手动链接依赖(仅RN 0.60及以下版本)

如果你的React Native版本低于0.60,需要手动链接依赖:

react-native link react-native-reanimated

内容的提问来源于stack exchange,提问作者Prajwal VK

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 19:45:54