【问题标题】:TypeError: _this7._config.server.rewriteRequestUrl is not a function React native 0.64.1TypeError: _this7._config.server.rewriteRequestUrl 不是函数 React native 0.64.1
【发布时间】:2021-08-12 00:03:08
【问题描述】:

我已按照upgrade helper 提供的所有说明将 RNv0.62 升级到 v0.64.1,并且我的应用程序已成功安装在设备中,但我的 Metro 捆绑程序失败,出现一些我无法理解的随机错误完全没有。

每当我尝试运行我的打包程序时,它都会抛出此错误TypeError: _this7._config.server.rewriteRequestUrl is not a function at node_modules/metro/src/Server.js:1011:39 如果有人可以帮助我,我应该怎么做才能调试它。

为了了解我在控制台中为我的项目和一个工作的 0.64.1 项目记录 _this7._config.server 对象所做的区别,显然它们都是不同的。

更新过程后我的_this7._config.server

{
  useGlobalHotkey: true,
  port: 8081,
  enableVisualizer: false,
  enhanceMiddleware: [Function (anonymous)],
  runInspectorProxy: true,
  verifyConnections: false
}

0.64.1 的其他 _this7._config.server 正在工作

{
  useGlobalHotkey: true,
  port: 8081,
  enhanceMiddleware: [Function (anonymous)],
  rewriteRequestUrl: [Function: rewriteRequestUrl],
  runInspectorProxy: true,
  verifyConnections: false
}

由于两者不同,我无法弄清楚到底出了什么问题

【问题讨论】:

    标签: javascript typescript react-native babeljs react-native-android


    【解决方案1】:

    我建议也升级你的 Metro 版本。

    我遇到了类似的问题,问题在于 Metro 版本冲突。

    我们的 Metro 版本是 0.56,当从 0.63 迁移到 0.64 时,@react-native-community/cli Metro 版本被撞到 0.64.0。

    因为这个地铁解析失败并抛出这个错误

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2021-11-21
    • 1970-01-01
    • 1970-01-01
    • 2022-08-23
    • 2020-10-28
    • 1970-01-01
    • 2017-07-27
    • 1970-01-01
    • 2020-12-25
    相关资源
    最近更新 更多