react-native eject error Unrecognized command "eject" - react-native

I'm trying to eject my app to generate Android folder. I knew it worked before, but when I type react-native eject in my React Native project's root directory I'm getting:
can-mbp:MyApp can$ react-native eject
warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
warn Package "bugsnag-react-native" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
warn Package "react-native-onesignal" is using deprecated "rnpm" config that will stop working from next release. Please notify its maintainers about it.
warn Package react-native-onesignal has been ignored because it contains invalid configuration. Reason: Unknown option dependency.platforms.ios.sourceDir with value ""./ios"" was found. This is either a typing error or a user mistake. Fixing it will remove this message.
error Unrecognized command "eject".
info Run "react-native --help" to see a list of all available commands.
I've searched for it but every answer points out to that react-native eject is simply the correct form and I couldn't find anything regarding that it doesn't work.
Here is my system info from react-native info command:
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU # 3.10GHz
Memory: 62.21 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.4.0 - /usr/local/bin/node
Yarn: 1.17.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.0-rc.2 => 0.60.0-rc.2
What am I doing wrong?

Since create-react-native-app is deprecated this functionality is no longer needed.
Due to this pr it's gone!
Personaly I don't like it but run npx react-native init YourProjectName and copy over what's necessary.
Update :
I copied to removed code and made a small package : https://www.npmjs.com/package/react-native-eject

Always working for me, first install in your project
yarn add react-native-eject
and then run
react-native eject
make sure you have install yarn in your pc

Type the following command
npx react-native eject

Related

React native customBubblingEventTypes error when running tests

I am running a simple test to render react native component using enzyme and jest. It's a monorepo setup using lerna for web and mobile with shared components. There is babel, jest config that's shared between packages. The app starts and works successfully using the component that I am testing without any warnings or errors. But for some weird reason when I run a test, I am getting this error
● Test suite failed to run
TypeError: Cannot read property 'customBubblingEventTypes' of undefined
at node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:2357:8
at Object. (node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:17:3)
at Object. (node_modules/react-native/Libraries/Renderer/shims/ReactNative.js:18:17)
This is the info from react-native info command.
info Fetching system and libraries information...
System:
OS: macOS 10.15.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU # 2.30GHz
Memory: 377.90 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.16.0 - ~/.nvm/versions/node/v12.16.0/bin/node
Yarn: Not Found
npm: 6.13.4 - ~/.nvm/versions/node/v12.16.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.9.1 - /Users/amal/.rvm/gems/ruby-2.3.1/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 27, 28
Build Tools: 27.0.3, 28.0.3
Android NDK: Not Found
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_202 - /usr/bin/javac
Python: 2.7.17 - /usr/local/bin/python
npmPackages:
#react-native-community/cli: Not Found
react: Not Found
react-native: 0.63.0 => 0.63.0
npmGlobalPackages:
*react-native*: Not Found
react and #react-native-community/cli is installed in root node-modules as hoisted by lerna in monorepo. maybe that's why the cli says it's not found.
This is a new react native setup with only the babel and shared node_modules as customised changes code. Only the test fails and it would be great if somebody can give insights. Thanks in advance.
This error was related to enzyme and not react native. It looks like though the enzyme website says it can be made to work with react-native, when using other packages like styled-components it never works. https://github.com/enzymejs/enzyme/issues/1436 - In case anyone is interested to follow the conversation in enzyme repo.
I used https://github.com/callstack/react-native-testing-library instead of enzyme for testing react native and it works smoothly!

cli : unable to talk to your watchman

I am new to React Native and I am trying to set up my development environment on Windows 8.1 as described in the official documentation.
But I have a problem
Steps :
react-native init AwesomeProject
cd AwesomeProject
react-native start
The app doesn't start correctly and I have this error :
2020-05-26T18:02:48,578: [cli] unable to talk to your watchman on \\.\pipe\watchman-ME! (No such file or directory)
Watchman: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2020-05-26T18:02:48,578: [cli] unable to talk to your watchman on \\.\pipe\watchman-ME! (No such file or directory)
So I figured the problem is with watchman
I found the path on this error weird (\\.\pipe\watchman-ME!) because when executing react-native info, I get the following :
System:
OS: Windows 8.1 6.3.9600
CPU: (8) x64 Intel(R) Core(TM) i7-4702MQ CPU # 2.20GHz
Memory: 4.36 GB / 7.93 GB
Binaries:
Node: 13.2.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.19.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.13.1 - C:\Program Files\nodejs\npm.CMD
Watchman: 20200424.164118.0 - C:\Users\ME\AppData\Local\watchman\watchman.EXE
SDKs:
Android SDK:
API Levels: 26, 27, 28, 29
Build Tools: 28.0.3, 29.0.2, 30.0.0
System Images: android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6392135
Languages:
Java: 1.8.0_241 - /c/Program Files/Java/jdk1.8.0_241/bin/javac
Python: 2.7.17 - /c/Python27/python
npmPackages:
#react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Is my configuration correct ? Because I read other posts, issues and the best recommendation was to reinstall watchman and reboot. I did it multiple times but no changes. If that matters I downloaded the latest CI build, extracted it and added it to the path as described in the docs.
But I keep getting the same error, I tried with existing and new projects as well.
EDIT :
When I start the app, I said it doesn't start correctly, what happens is that it actually opens a white screen with a green bar saying Loading from 10.0.2.2:8081 ..., I read about it (example) and I tried every proposed solution, everything seems all right but I keep getting the same error !

React Native: AwesomeProject not starting in emulator

I’m attempting to start up up the AwesomeProject basic project in react native, which is hanging when attempting to hit http://localhost:8081. 

Currently, the iOS emulator is starting up properly by running
yarn ios

After a short period of time, I’m met with the red error screen everyone loves stating “Could not connect to development server.

Here are the current tool versions.
Mac OS: 10.15.4 (macOS Catalina)
NodeJS: v10.19.0
yarn: 1.22.4
npm: 6.13.4
react-native cli: 3.2.1
react-native npm bundle: 0.61.4
expo: 3.15.5
expo npm bundle: 36.0.0
watchman: 4.9.0
xcode: 11.4 (11E146)

I’ve tried numerous ideas such as:
Trying to hit the 8081 url through the browser upon the emulator. I was able to hit the http url just fine
Tried to clear all caches, remove node_modules folder, etc
Ensured the OS firewall is disabled
Upgraded to the latest version of Node
As this point, I'm completely stuck lol and need to get this silly app working.
Can anyone here recommend some ideas?

Expo Publish on Android using Google App Signing broken

I have successfully published my app as a bundle (aab) on the PlayStore. I wanted to install a small update after a few days, because there are problems with the keyboard. I have executed "expo build:android -t app-bundle" as usual.
Afterwards I tried to upload directly via the cli (after it failed with the message that the fingerprint is invalid) also via the PlayStore. I got the same message that the fingerprint of the upload key does not match.
I have tried to download the upload key, but I get the following message:
expo fetch:android:upload-cert
There is no valid Keystore defined for this app Writing upload key to /my/path/to/xxxxx_upload_cert.pem
keytool exited with non-zero code: 1
I had "Google App Signing" enabled in PlayStore from the beginning, even before I knew anything about an "expo opt-in" command. There was already an upload certificate in my PlayStore. I let Expo manage the entire process and never generated anything myself.
Now I'm stuck here and don't know what to do. I can't download any hashes or upload certificates, nor can I update my app. This is absolute horror right now. I had extra Expo manage everything to avoid problems right here.
How can we fix the problem now?
Expo CLI 3.11.3 environment info:
System:
OS: macOS 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.3 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.13.2 - ~/Gitlab/xxxx/xxxx/xxxx-app/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
expo: ^36.0.0 => 36.0.0
react: 16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4
react-navigation: ^4.0.10 => 4.0.10
I've solved the keytool exited with non-zero code: 1 just downloading and installing the last JDK from here.
This issue got addressed by the expo team and is resolved
https://forums.expo.io/t/can-update-app-in-playstore-problems-with-signing-and-fingerprint/31520/4

There are no Libraries linked in iOS project of react-native

I have tried to create a new project in react-native, After creating when I have opened the iOS project, in libraries folder I could not any libraries and i am not able to run the iOS Project.
I have tried react-native run-ios
Got error like "error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AppName.xcodeproj."
Steps To Reproduce
Lis
cd AppName
open ios/AppName.xcodeproj inxcode and build.
react-native init AppName
I have tried to create multiple projects, but still no luck of getting libraries
react-native info logs
System:
OS: macOS 10.14.5
Binaries:
Node: 11.3.0 - /usr/local/bin/node
Yarn: 1.5.1 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
npmGlobalPackages:
react-native-cli: 2.0.1
I have fixed the issue, by searching over SO and found a solution
In React-native 0.60 +, you need to install pods
Step1: cd ios
Step2: pod install
Step3: pod update
After completion you can run.