参考错误:找不到变量:

编程入门 行业动态 更新时间:2024-10-18 01:39:49
本文介绍了参考错误:找不到变量:__DEV__的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

When I launch my project I am getting a ReferenceError: Can't find variable: __DEV__ error. I have commented out almost all of my code and now only have this

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 控制台为空白.在这一点上,我不知道还能尝试什么.

I have tried wiping out my node_modules folder and doing a clean build from Xcode. The packager console output doesn't show any problems and the Xcode Console is blank. At this point I don't know what else to try.

推荐答案

问题出在我的 .babelrc 文件中有 "strict".看起来 react-native 正在分配 __DEV__ 而不声明它.

The problem was having "strict" in my .babelrc file. It appears that react-native is assigning __DEV__ without declaring it.

github/facebook/react-native/issues/3605

更多推荐

参考错误:找不到变量:

本文发布于:2023-07-04 17:14:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1026944.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   变量   错误

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!