【问题标题】:ReferenceError: Can't find variable: __DEV__ [duplicate]ReferenceError:找不到变量:__DEV__ [重复]
【发布时间】:2016-01-21 18:34:06
【问题描述】:

当我启动我的项目时,我收到了 ReferenceError: Can't find variable: __DEV__ 错误。我已经注释掉了几乎所有的代码,现在只有这个

import React, {
    Component,
    Text
} from "react-native";

var {
    AppRegistry
} = React;

class Root extends Component {
    render() {
        return (
            <Text>App</Text>
        );
    }
}

AppRegistry.registerComponent("App", () => Root);

我已尝试清除我的 node_modules 文件夹并从 Xcode 进行干净的构建。打包程序控制台输出没有显示任何问题,Xcode 控制台为空白。在这一点上,我不知道还能尝试什么。

【问题讨论】:

    标签: react-native


    【解决方案1】:

    问题在于我的"strict" 文件中有"strict"。看来 react-native 正在分配 __DEV__ 而没有声明它。

    https://github.com/facebook/react-native/issues/3605

    【讨论】:

    • 看到这个,尽管 .babelrc 中没有“严格”
    • 我同意@MaxMacLeod,我也看到了这一点,而 .babelrc 没有严格
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-20
    • 2018-04-24
    • 2016-10-30
    • 2012-03-18
    • 2015-11-16
    • 2011-05-22
    • 2014-12-16
    相关资源
    最近更新 更多