Lottie-react-native: Unable to resolve module 'react-native-safe-module' from 'node_modules\lottie-react-native\lib\LottieView.js' react-native-safe-module could not be found within the project

Created on 12 Feb 2020  路  5Comments  路  Source: lottie-react-native/lottie-react-native

Description

Updated the lottie library in my react-native project from 2.6.1 to 3.3.2 using. The project built successfully but while loading the js from metro bundler got this error. Had to install 'react-native-safe-module' manually to resolve the issue

[Description of the bug]

Steps to Reproduce

  1. npm i --save lottie-react-native@latest
  2. react-native run-android
  3. Build succeeds
  4. Metro bundler throws the above error while loading javascript
  5. To resolve the error, install 'react-native-safe-module' manually. npm i --save react-native-safe-module
  6. Error is resolved and the app js loads and i am able to open the app

Actual behavior: [What actually happened]
Metro bundler throws the error while loading javascript

Expected behavior: [What you expected to happen]
Should not need to install 'react-native-safe-module' manually or should throw an error during build time instead of during js load time or atleast the repo readme should contain instructions to install the dependency

Versions

2.6.1 -> 3.3.2

Most helpful comment

Me too. I resolved this problem by the script:tada:
Please try it before build app 鈽猴笍

watchman watch-del-all;
rm -rf node_modules/*;
rm -rf $TMPDIR/react-*;
rm -rf $TMPDIR/metro-bundler-cache-*;
rm -rf $TMPDIR/metro-cache/*;

All 5 comments

Needed to upgrade from 2.6.1 to 3.3.2 after ejecting from expo to bare workflow because the lottie animations were not rendering after ejection outside of expo environment. It still worked ok if i ran the ejected app in expo client. Upgrading to 3.3.2 seems to have fixed this issue.

Hi, I am facing the same issue. I upgrade lottie-react-native to 3.3.2, after that I am facing this. Can you please help

I meet this issue too.
I am using lottie-react-native 3.3.2 with SDK37 expo bare workflow

Me too. I resolved this problem by the script:tada:
Please try it before build app 鈽猴笍

watchman watch-del-all;
rm -rf node_modules/*;
rm -rf $TMPDIR/react-*;
rm -rf $TMPDIR/metro-bundler-cache-*;
rm -rf $TMPDIR/metro-cache/*;

@emilioicai Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

snydercreative picture snydercreative  路  4Comments

ASkyBig picture ASkyBig  路  4Comments

nok0620 picture nok0620  路  3Comments

Nitaaq picture Nitaaq  路  4Comments

duringg picture duringg  路  5Comments