Search code examples
react-nativecreate-react-native-app

command npm run eject show error Eject failed with exit code 1


I can create react native project by typing command create-react-native-app myappname and then cd to the project use npm run eject choose a regular react native project before.

But i meet the error recently, i can't figure it out why it happens like this.

When i type command create-react-native-app myappname i see the log message in the end:

Installing dependencies using yarn...

    yarn install v1.5.1
    warning You are using Node "6.2.1" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
    [1/4] 🔍  Resolving packages...
    [2/4] 🚚  Fetching packages...
    error @babel/[email protected]: The engine "node" is incompatible with this module. Expected version ">=6.9.0".
    error An unexpected error occurred: "Found incompatible module".
    info If you think this is a bug, please open a bug report with the information provided in "/Users/motogod19/ReactNativeTutorial/testone/yarn-error.log".
    info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
    Failed to install

And then when i try to type command npm run eject and choose a regular react native project, it shows the error:

Eject failed with exit code 1, see above output for any issues.
You may want to delete the `ios` and/or `android` directories.

Just like the image: enter image description here

What problem with my step ? Is yarn version ?

Any help would be appreciated. Thanks in advance.


Solution

  • Although it might be too late for you, your node version seems to be lower than 6.9.0, just update it to any version greater than that and install dependencies by running yarn install within the project folder.

    Hope you solved it already anyhow.