命令 npm 运行 eject show error Eject failed with exit code 1

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

我可以通过输入命令 create-react-native-app myappname 然后 cd 到项目使用 npm run eject 之前选择 a regular react native project 来创建 React Native 项目。

但是我最近遇到了错误,我想不通为什么会这样。

当我键入命令 create-react-native-app myappname 时,我看到最后的日志消息:

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/core@7.0.0-beta.49: 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

然后当我尝试键入命令 npm run eject 并选择 a regular react native project 时,它显示错误:

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

就像图片一样:

我的步骤有什么问题吗?是yarn版本吗?

如有任何帮助,我们将不胜感激。提前致谢。

虽然对你来说可能为时已晚,但你的节点版本似乎低于 6.9.0,只需将其更新到高于该版本的任何版本并通过 运行 yarn install 安装依赖项即可项目文件夹。

希望你已经解决了。