命令npm run eject show error弹出失败,退出代码为1

时间:2018-06-01 14:11:23

标签: react-native create-react-native-app

我可以通过键入命令create-react-native-app myappname创建反应原生项目,然后cd创建项目使用npm run eject之前选择a regular react native project

但我最近遇到了错误,我无法弄清楚为什么会这样。

当我输入命令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.

就像图片一样: enter image description here

我的步骤有什么问题?是纱线版吗?

任何帮助将不胜感激。提前谢谢。

1 个答案:

答案 0 :(得分:2)

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

希望您已经解决了它。