Search code examples
react-nativereact-native-cli

react-native eject error Unrecognized command "eject"


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?


Solution

  • 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