TypeError: Cannot read property 'getCurrentUserAsync' of undefined - react-native

I am trying to debug my react-native app using 'Debug in Exponent'
and I got this error where the packager is starting successfully but with the error in the console
Configurations are:
VSCODE Version: 1.35.1
React-Native VS Code extension version: 0.10.2
Node.js: 10.2.0
OS: Linux x64 4.4.0-154-generic
Expo: 2.21.1
I have tried upgrading and downgrading the vscode.
deleted the node_module and installed npm again.
I even cleared out all the settings and created the fresh launch.json in .vscode so far with no success
error in console is as follows
[Info] Making sure your project uses the correct dependencies for Expo. This may take a while...
Checking if this is Expo app......
[Info] Packager is already running.
[Info] Prewarming bundle cache. This may take a while ...
[Info] Building and running application.
[Error] TypeError: Cannot read property 'getCurrentUserAsync' of undefined

Same problem occurs with the configuration below :
VSCODE Version: 1.36.1
React-Native VS Code extension version: 0.10.2
Node.js: 10.15.1
OS: Win32 x64
Expo: 3.0.2

The temporary workaround is described here which worked for me..

Related

Error with CocoaPods dependencies (Multiple Podfiles were found) while setting up react react native CLI environment on MacOS M1

After I create a new project using the below code in terminal
niteshrastogi#Niteshs-MacBook-Air ~ % npx react-native init AwesomeProject1
Takes a lot of time on Installing Cocoapods dependencies step and returns an error. See this Error
✔ Downloading template
✔ Copying template
✔ Processing template
✔ Installing Bundler
✖ Installing CocoaPods dependencies (this may take a few minutes)
error warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
at createFromTemplate (/Users/niteshrastogi/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/init/init.js:129:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.initialize [as func] (/Users/niteshrastogi/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/commands/init/init.js:181:3)
at async Command.handleAction (/Users/niteshrastogi/.npm/_npx/7930a8670f922cdb/node_modules/#react-native-community/cli/build/index.js:106:9)
I am new to development and trying to setup a development environment for the first time. Any help with this would be helpful.
Followed all the steps mentioned here to set up react native CLI and create my first project.
System config: M1 Ventura 13.2 macos watchman version: 2023.02.06.00 homebrew version: Homebrew 3.6.21 node: v19.6.0
Also installed Xcode with the latest version and selected the latest command line tool location.
enter image description here

React Native code is not running on Emulator in VS Code

Emulator is opening fine when I try to run the code with the command in VS Code but code is not running on it. Something is wrong that I'm unable to solve. Please help!
Following is the error -
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:7884) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 870 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:\OLA\OlaProject\android\settings.gradle'
* What went wrong:
Could not compile settings file 'D:\OLA\OlaProject\android\settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 60
settings.gradle
rootProject.name = 'OlaProject'
apply from: file("../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
gradle.properties
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.99.0
Can you share your settings.gradle and Gradle-wrapper.properties file?
Maybe it's problem with the gradle version you are using, try to change your gradle version in gradle-wrapper.properties file and see if it's working or not.
Also check build.gradle and see if com.android.tools.build:gradle:x.x.x is compatible with your current gradle version
https://developer.android.com/studio/releases/gradle-plugin

Can't run react-native run-android?

I'v followed the steps from https://reactnative.dev/docs/environment-setup. I can start the phone emulator from AVD Manager in Android Studio and I can run react-native start without problems. When i enter in another terminal react-native run-android I get the following error:
info Running jetifier to migrate libraries to AndroidX. You can
disable it using "--no-jetifier" flag. (node:9612) Warning: Accessing
non-existent property 'padLevels' of module exports inside circular
dependency (Use node --trace-warnings ... to show where the warning
was created) Jetifier found 967 file(s) to forward-jetify. Using 16
workers... info Starting JS server... info Launching emulator... info
Successfully launched emulator. info Installing the app... Downloading
file:/D:/App/AwesomeProject/android/gradle/wrapper/services.gradle.org/distributions/gradle-6.7-all.zip
Exception in thread "main" java.io.FileNotFoundException:
D:\App\AwesomeProject\android\gradle\wrapper\services.gradle.org\distributions\gradle-6.7-all.zip
(The system cannot find the path specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
at java.base/java.io.FileInputStream.(FileInputStream.java:153)
at java.base/java.io.FileInputStream.(FileInputStream.java:108)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:189)
at org.gradle.wrapper.Download.downloadInternal(Download.java:78)
at org.gradle.wrapper.Download.download(Download.java:63)
at org.gradle.wrapper.Install$1.call(Install.java:68)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
error Failed to install the app. Make sure you have the Android
development environment set up:
https://reactnative.dev/docs/environment-setup. Run CLI with --verbose
flag for more details. Error: Command failed: gradlew.bat
app:installDebug -PreactNativeDevServerPort=8081 Exception in thread
"main" java.io.FileNotFoundException:
D:\App\AwesomeProject\android\gradle\wrapper\services.gradle.org\distributions\gradle-6.7-all.zip
(The system cannot find the path specified)
And if I run react-native info I get:
info Fetching system and libraries information... (node:14952)
Warning: Accessing non-existent property 'padLevels' of module exports
inside circular dependency (Use node --trace-warnings ... to show
where the warning was created) System:
OS: Windows 10 10.0.19041
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 23.88 GB / 31.90 GB Binaries:
Node: 14.15.0 - D:\nodejs\node.EXE
Yarn: Not Found
npm: 6.14.8 - D:\nodejs\npm.CMD
Watchman: Not Found SDKs:
Android SDK: Not Found
Windows SDK: Not Found IDEs:
Android Studio: Not Found
Visual Studio: Not Found Languages:
Java: 15.0.1
Python: 3.9.0 npmPackages:
#react-native-community/cli: ^4.13.0 => 4.13.0
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-windows: Not Found npmGlobalPackages:
react-native: Not Found
I'v tried a lot of things but nothing seems to work.
Looks like an issue with gradle version.
Do these.
remove android/.gradle folder.
open /android in android studio
goto File->Project Structure->Project and change Gradle Version to more recent one. and wait for it to complete gralde sync task.
run react-native run-android after this.

ReactNative fails to deploy build to iOS simulator but does deploy it to Android emulator

ReactNative fails to deploy build to iOS simulator but does deploy it to Android emulator
Attached are screenshots showing this on both.
Steps:
Created react native app
react-native init proto
Run app on Android emulator after I started emulator
react-native run-android
this is running fine on Android emulator
Run app on iOS simmulator
react-native run-ios
This produces error as per screenshot
Error
** BUILD FAILED **
The following build commands failed:
CompileC /Users/dinob/reactnativework/proto/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTShadowView+Internal.o Views/RCTShadowView+Internal.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/proto.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/proto.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Versions
MacBookPro OSX El Capitain
react-native 0.55.3
react-native-cli 2.0.1
npm 5.5.1
node v8.9.1
watchman 4.9.0
Please have a look here for help with troubleshooting
I would suggest you try all the solutions described in that thread to try and fix this issue. Good Luck!

Error 'Could not determine java version from ‘10’

npm run android is not working.
node version: v8.9.4
npm version: 5.7.1
genymotion: 2.12.0
I'm getting the error:
Could not determine java version from ‘10’
I don't have have an Android Studio installed, but I have installed Gradle 4.6, and also set the path for Java, created JAVA_HOME and set path for genymotion.
Revert back the java version to 8*. Android does not support 9 or above, yet.