Syed
Syed

Reputation: 530

Unrecognized command 'run-eject'

I want to eject my react-native so I can install mobx but running both 'yarn run eject' and 'npm run eject' doesn't work.i think this is new issue and so couldn't find help online. any help would be appreciated. this is my package.json file and the error given belowHere is the photo.

{
  "name": "a2x",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-preset-react-native-stage-0": "^1.0.1",
    "jest": "^22.4.4",
    "jest-react-native": "^18.0.0",
    "react-test-renderer": "16.3.1"
  },
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "test": "jest",
    "eject": "react-native run-eject"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "mobx": "^5.5.0",
    "mobx-react": "^5.2.8",
    "react": "16.3.1",
    "react-native": "~0.55.2",
    "react-native-elements": "^0.19.1",
    "react-navigation": "^2.0.1"
  }
}

Upvotes: 1

Views: 3534

Answers (3)

Aakash Sajjad
Aakash Sajjad

Reputation: 97

Always working for me, only follow two steps 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

Upvotes: 0

Ravi
Ravi

Reputation: 35569

Actual command is react-native eject.

It will create new folder for android and iOS to run it seperately on native.

As you said you are getting error of Both the iOS and Android folders already exist!, so please delete it and try with this command.

If you already have android and ios folder with some native implementation, there is no need to use eject command at all.

regarding npm run reject command, I guess this will be more useful to clear everything.

Upvotes: 1

Buwaneka Sirinath
Buwaneka Sirinath

Reputation: 115

Try npm run eject..not npm run-eject But if you trying to add native dependencies later i think better to start project using react native init. not using create-react-native-app.

Upvotes: 1

Related Questions