Cannot find module 'metro-symbolicate/src/Symbolication' - react-native

I got this error while i follow the tutorial on react native of Mosh ( youtube link )
I'm totaly new to react native so someone can explain what is going on and how to solve it ?
here the prompt i get when i launch expo start command
MacBook-Pro-de-MAC:DoneWithIt mac$ expo start
Starting project at /Users/mac/Documents/projects/loto/test/DoneWithIt
Developer tools running on http://localhost:19002
Unable to reach Expo servers. Falling back to using the cached dependency map (bundledNativeModules.json) from the package "expo" installed in your project.
Cannot find module 'metro-symbolicate/src/Symbolication'
Require stack:
- /Users/mac/Documents/projects/loto/test/DoneWithIt/node_modules/metro/src/Server/symbolicate.js
- /Users/mac/Documents/projects/loto/test/DoneWithIt/node_modules/metro/src/Server.js
- /Users/mac/Documents/projects/loto/test/DoneWithIt/node_modules/metro/src/index.js
- /usr/local/lib/node_modules/expo-cli/node_modules/#expo/dev-server/build/metro/importMetroFromProject.js
- /usr/local/lib/node_modules/expo-cli/node_modules/#expo/dev-server/build/HermesBundler.js
- /usr/local/lib/node_modules/expo-cli/node_modules/#expo/dev-server/build/MetroDevServer.js
- /usr/local/lib/node_modules/expo-cli/node_modules/xdl/build/start/startDevServerAsync.js
- /usr/local/lib/node_modules/expo-cli/node_modules/xdl/build/internal.js
- /usr/local/lib/node_modules/expo-cli/node_modules/xdl/build/index.js
- /usr/local/lib/node_modules/expo-cli/build/exp.js
- /usr/local/lib/node_modules/expo-cli/bin/expo.js

Related

Connection to flow server got closed. See the output for more information

I got this error message when using React Native on vscode. Is there a way to fix it?
[Error - 2:57:25 PM - MyRealmApp\.flowconfig] Error loading flow using option 'useNPMPackagedFlow'
Pkg flow-bin not found in c:\Users\ReactNativeProjects\MyRealmApp
[Error - 2:57:25 PM - MyRealmApp\.flowconfig] Error loading flow using option 'pathToFlow'
'flow' not found
[Info - 2:57:25 PM - MyRealmApp\.flowconfig] Falling back to bundled flow.
[Info - 2:57:27 PM - MyRealmApp\.flowconfig] Using flow 'c:\Users\.vscode\extensions\flowtype.flow-for-vscode-1.9.2\node_modules\flow-bin\flow-win64-v0.107.0\flow.exe' (v0.107.0)
.flowconfig:28 Unsupported option specified! (format.bracket_spacing)
[Error - 2:57:28 PM] Connection to server got closed. Server will not be restarted.
Basically this issue was caused by not having installed the same version of flow-bin as declared in the .flowconfig of the projects.
Now what you have to do to fix that, is to maintain coherence in the current .flowconfig of the project in your VS Code.
How to do that?
You can just do the below thing and it will fix your issue. If you don't have a yarn, then use npm in place of yarn.
yarn global add flow-bin#version
npm run ios or npm run android
The above will help you fix the issue, but you will always have to check whether they are getting pointed to the same version. In order to fix it stably, you can do the following:
In your VS Code settings you need to point flow.pathToFlow to your workspace node_module:
// settings.json
{
"flow.pathToFlow": "${workspaceFolder}/node_modules/.bin/flow",
}
${workspaceFolder} is a special variable provided by VS Code and it always points to the current project folder. You can find it in the variables reference page of the official docs.
You can prefer to use the local Flow module because this way you can ensure that the installed version and the configured one in .flowconfig always match even when you switch projects.
There is an extra setting for that: flow.useNPMPackagedFlow, just set it to true and you are done (no need to change flow.pathToFlow)

React native link fails with no package found

I'm not sure what exactly is happening but I am unable to run react-native link without errors occuring
CLI Output:
react-native link --verbose
debug Available platforms: iOS, Android
debug Targeted platforms: iOS, Android
debug Getting project config for iOS...
debug Getting project config for Android...
error No package found. Are you sure this is a React Native project?
error Unexpected close tag
Line: 22
Column: 24
Char: >
debug Error: Unexpected close tag
Line: 22
Column: 24
Char: >
at error (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:666:10)
at strictFail (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:692:7)
at closeTag (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:885:9)
at SAXParser.write (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/node_modules/sax/lib/sax.js:1447:13)
at new XmlDocument (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/xmldoc/lib/xmldoc.js:199:15)
at readManifest (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/tools/android/readManifest.js:44:10)
at Object.projectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/tools/android/index.js:66:46)
at Object.keys.forEach.platform (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/commands/link/getProjectConfig.js:25:62)
at Array.forEach (<anonymous>)
at getProjectConfig (/Users/Dellybro/Desktop/App/AppReactNativeApp/node_modules/#react-native-community/cli/build/commands/link/getProjectConfig.js:22:35)
This randomly started happening after attempting to npm install react-native-firebase.
What I've tried
clear-caches
remove node_modules and npm install
Checking out my code back to a previous commit
Adding my package name to the manifest locaed in /android/app/src/debug/AndroidManifest.xml
Removing the app from my computer and cloning it from github
Running react-native link on another project, which works, but i just can't run react-native link on this specific project.
So the answer to my question was that in my android manifest xml file, there was an incorrect closing brace for one of my intent filters.
So for anyone that this happens to ensure that all of your Android files have correct syntax.
I fixed this problem by closing some unclosed tag in android/app/src/main/androidManifest.xml. Try checking the file line by line.

React-Native - Could not connect to development server (iOS simulator)

Error:
Could not connect to develpment server.
Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
URL: http://127.0.0.1:8081/index.ios.bundle?platform=ios&dev=true
I definitely am running npm start. Why isn't this running?
Now I am seeing this Error:
In file included from /Users/*******/f8app/node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAccessToken.m:19:
/Users/*********/f8app/node_modules/react-native-fbsdk/ios/RCTFBSDK/core/RCTFBSDKAccessToken.h:21:9: fatal error:
'FBSDKCoreKit/FBSDKCoreKit.h' file not found
#import <FBSDKCoreKit/FBSDKCoreKit.h>
Does the project build succeed in Xcode?
Did you double-check these steps mentioned by facebook:
Make sure that the Facebook SDK frameworks are installed in
~/Documents/FacebookSDK.
Make sure that FBSDK[Core, Login, Share]Kit.framework show up in the
Link Binary with Libraries section of your build target's Build
Phases.
Make sure that ~/Documents/FacebookSDK is in the Framework Search
Path of your build target's Build Settings.
(https://github.com/facebook/react-native-fbsdk)
I myself had some troubles with the final step, but after retrying in a fresh project all worked fine
Example image from web showing the correct search path
If the project build doesn't succeed, you may want to try this.
You should first update your existing FBSDK (if any)
https://medium.com/#alberto.schiabel/react-native-on-xcode-beta-8-0-how-to-fix-initial-build-error-f0225c649850#.439zl5504

Could not find com.android.support:support-v4:23.2.1

When using react-native 0.28 and above (0.29, 0.30-rc), I get the following error when executing react-native run-android in a fresh react-native init app project.
Could not find com.android.support:support-v4:23.2.1.
I installed the newest android studio and even installed the obsolete library manually.
What am I doing wrong?
Thanks!
To complete Tonithy's answer - the .jar may not be enough, you need to copy two whole directories, otherwise gradle will complain for the missing .aar. In this case, I think that those were installed by Android Studio:
{USER}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/
And don't forget the dependency:
{USER}/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.2.1/
I had exactly the same problem while upgrading to react-native 0.30, that solved the issue.
Google seems to have stopped including a version of each support library without sources/javadoc/etc and React is looking for this specific file. Assuming you manually installed the obsolete version, it will be in {YOUR_ANDROID_LOCATION}/extras/android/support/v4/android-support-v4.jar Your best bet is to manually copy it in:
cp {YOUR_ANDROID_LOCATION}/extras/android/support/v4/android-support-v4.jar {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
This a React Native (version and probably OSX specific bug), it will probably be fixed soon. For posterity, your full error was something like this, looking for support in all the wrong places:
OsagieTheGreat-MBA:somereactapp osagiethegreat$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:23.2.1.
Searched in the following locations:
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
Required by:
SomeReactApp:app:unspecified > com.android.support:appcompat-v7:23.0.1
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.android.support:recyclerview-v7:23.0.1
> Could not find com.android.support:support-v4:23.2.1.
Searched in the following locations:
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/.m2/repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Users/osagiethegreat/Documents/somereactapp/node_modules/react-native/android/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/android/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom
file:/Applications/Android Dev/sdk/extras/google/m2repository/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar
Required by:
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:imagepipeline-okhttp3:0.11.0 > com.facebook.fresco:imagepipeline:0.11.0
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:fresco:0.11.0 > com.facebook.fresco:drawee:0.11.0
SomeReactApp:app:unspecified > com.facebook.react:react-native:0.29.0 > com.facebook.fresco:imagepipeline-okhttp3:0.11.0 > com.facebook.fresco:imagepipeline:0.11.0 > com.facebook.fresco:imagepipeline-base:0.11.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 10.838 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
I also got this error, after installing Android Support Library the error has gone.
Install Android Support Library from Extras
First solution could be adding this
compile 'com.android.tools:sdklib:23.2.1'
to the next file
android/app/build.gradle
Second solution is installing Android Support Repository
To Complete Tonithy's and Simon's answer, yes the jar itself was not enough, all the files of two directories -
extras/android/m2repository/com/android/support/support-v4/23.2.1/ and
extras/android/m2repository/com/android/support/support-annotations/23.2.1/ are needed. On my Windows PC, I couldn't find files of these directories anywhere.
So what I did was, I downloaded these folders from googlesource
1. support/support-annotations/23.2.1
Download tgz of above folder and extract the files into {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-annotations/23.2.1/
2. support/support-v4/23.2.1
Download tgz of above folder and extract the files into {YOUR_ANDROID_LOCATION}/extras/android/m2repository/com/android/support/support-v4/23.2.1/
Now go to your command propmt or terminal and run react-native run-android
Hope it save someone few hours!!

React-native Awesome project not building android project

I am trying to learn react-native but am not able to build the demo AwesomeProject. I have set the $ANDROID_HOME variable in ~/.bash_profilefile. But every time I build it I get following error.
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.android.support:appcompat-v7:23.0.1.
Searched in the following locations:
file:/Users/<username>/.m2/repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom
file:/Users/<username>/.m2/repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar
Required by:
AwesomeProject:app:unspecified
Could not find com.android.support:appcompat-v7:23.0.1.
Searched in the following locations:
file:/Users/<username>/.m2/repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom
file:/Users/<username>/.m2/repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar
https link Required by:
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0
Could not find com.android.support:support-v4:21.0.3.
Searched in the following locations:
file:/Users/<username>/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
file:/Users/<username>/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
https link
Required by:
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:drawee:0.6.1
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:imagepipeline:0.6.1
I don't know why it's looking in this folder file:
/Users/<username>/.m2/repository/com/android/support/appcompat-v7/23.0.1
Installed sdk version is 23.0.1 still I am getting this error.
I have a dotnet background trying to learn react-native.
Finally got it. You have to install Android Support Repository in Extras, in the Android SDK manager
Open the SDK, scroll down to the last part, open the extras, select android support repository, and click on "install packages" here is a screenshot