Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未捕获引用错误:React native 0.59.5中未定义require_Javascript_React Native - Fatal编程技术网

Javascript 未捕获引用错误:React native 0.59.5中未定义require

Javascript 未捕获引用错误:React native 0.59.5中未定义require,javascript,react-native,Javascript,React Native,升级到React Native 0.59.5后,我得到: Uncaught reference error: require is not defined babel.config.js module.exports={ 预设:[ “模块:地铁反应本地巴别塔预设”, “@babel/预设流量”, [ “@babel/preset env”, { 目标:{ 埃斯摩杜勒斯:没错, }, }, ], “airbnb”, ], 插件:[ “转换类属性”, ['@babel/plugin-proposi

升级到React Native 0.59.5后,我得到:

Uncaught reference error: require is not defined
babel.config.js

module.exports={
预设:[
“模块:地铁反应本地巴别塔预设”,
“@babel/预设流量”,
[
“@babel/preset env”,
{
目标:{
埃斯摩杜勒斯:没错,
},
},
],
“airbnb”,
],
插件:[
“转换类属性”,
['@babel/plugin-proposition-decorators',{legacy:true}]
],
};
节点:8.10.0 npm:5.6.0 自然反应:0.59.5


尝试执行以下babel配置,如果缺少,请不要忘记安装所需的库:

module.exports = {
  presets: ["@babel/preset-flow", "module:metro-react-native-babel-preset"],
  plugins: [
    ["@babel/plugin-proposal-decorators", { legacy: true }],
    ["@babel/plugin-transform-flow-strip-types"],
    ["babel-plugin-react-native-nodeify-hack"],
    "@babel/plugin-syntax-dynamic-import",
    [
      "@babel/plugin-proposal-class-properties",
      {
        loose: true
      }
    ],
    "@babel/plugin-transform-regenerator",
    [
      "@babel/plugin-transform-runtime",
      {
        helpers: false,
        regenerator: true
      }
    ]
  ]
};
然后可以使用此命令清理项目(仅限IOS)

然后重新运行项目

react-native run-ios

希望这能解决你的问题

检查这个,如果你还没有:我甚至没有
env:{development}
,还有什么我应该更改的吗?谢谢你会尝试并发布结果。别忘了根据你的项目更改pod deintegrate ios/{your_PROJECT}.xcodeproj。希望它最终对你有用
react-native run-ios