Search code examples
react-nativereact-native-fbsdk

react native fbsdk MODULE_NOT_FOUND after link commend


I searched for this error on the git repo and online but I didn't find anything what brings me to here. React native is totally new for me so if I missed something stupid, my apologize.

I'm trying to install & link react-native-fbsdk in my react-native project: https://github.com/facebook/react-native-fbsdk

I went through these steps:

react-native init [YourApp]

Result: done, project created

react-native install react-native-fbsdk

Output: Scanning 712 folders for symlinks in C:\wamp\www\chatapp\node_modules (26ms) rnpm-install info Module react-native-fbsdk has been successfully installed & linked

react-native link react-native-fbsdk

Output: Scanning 712 folders for symlinks in C:\wamp\www\chatapp\node_modules (29ms) { [Error: Cannot find module 'C:\wamp\www\chatapp\node_modules\react-native-fbsdk\package.json'] code: 'MODULE_NOT_FOUND' }

Print screen: error output

Of course when I try to build my app with react-native run-android I got this:

...
:app:processDebugResources                 
:app:generateDebugSources                 
:app:processDebugJavaRes UP-TO-DATE      
:app:compileDebugJavaWithJavac                 
C:\wamp\www\chatapp\android\app\src\main\java\com\chatapp\MainApplication.java:16: error: cannot find symbol
import com.facebook.FacebookSdk;
...

More Info:

  • React native version: 0.42.3
  • npm -version 4.2.0
  • I didn't find "react-native-fbsdk" folder under my node_modules folder.
  • Windows 8.1
  • I'm working with Android Studio
  • Android SDK Platform-Tools 25.0.4
  • Android SDK Tools 25.2.3

Thank you in advance. Leo.

EDIT + UPDATE: Added react-native tag. Facebook team investigated this and it looks like an issue with React Native itself. https://developers.facebook.com/bugs/1889723254644374


Solution

  • After few days with the community I found the problem!

    This line is not valid commend for react native!

    react-native install react-native-fbsdk
    

    Instead we need to write:

    npm i -S react-native-fbsdk
    

    and then

    react-native link react-native-fbsdk