【问题标题】:undefined is not an object(ecaluating 'ReactInternals.ReactCurrentOwner')undefined 不是对象(正在计算“ReactInternals.ReactCurrentOwner”)
【发布时间】:2017-11-13 07:59:51
【问题描述】:

我想运行我的 react-native 项目,但发生了错误。 请给我建议。

环境

$ npm list --depth=0
nav@0.0.1 /Dev/lrn/rn/nav
├── babel-jest@20.0.3
├── babel-preset-react-native@1.9.2
├── jest@20.0.4
├── UNMET PEER DEPENDENCY react@16.0.0-alpha.6
├── react-native@0.45.1
├── react-navigation@1.0.0-beta.11
└── react-test-renderer@16.0.0-alpha.12

项目目录

$ls
__tests__         index.android.js  node_modules      yarn.lock
android           index.ios.js      package-lock.json
app.json          ios               package.json

我做什么

$ rm -rf node_modules
$ npm cache clean --force
$ npm install
$ react-native run-ios

错误 Red Screen iPhone Simulator

我认为环境是错误的,但我无法纠正它。 感谢您的观看,欢迎提出任何建议。谢谢。

【问题讨论】:

    标签: react-native npm


    【解决方案1】:

    在阅读了他们的Github Issues 之后,我遇到了同样的问题

    yarn add react@16.0.0-alpha.12
    

    npm i react@16.0.0-alpha.12 --save
    

    为我做了诀窍。

    【讨论】:

    • 在哪里添加这个纱线 add react@16.0.0-alpha.12 ??
    • @Rajasekherreddy 从您的终端运行它。 Yarn 是另一个包管理器,类似于 npm,除了自己的 yarn.lock 锁文件外,它也使用 package.json
    • 不使用纱线怎么办?
    • 你应该考虑切换。但 npm 的等效命令是 npm install react@16.0.0-alpha.12
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-05
    • 2019-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-14
    相关资源
    最近更新 更多