【问题标题】:Unable to download JS bundle on UWP React Native无法在 UWP React Native 上下载 JS 包
【发布时间】:2018-01-26 01:51:58
【问题描述】:

环境

react-native -v: 0.47.0
npm ls rnpm-plugin-windows: 0.47.0-RC5
npm ls react-native-windows: yes
node -v:8.2.1
npm -v:5.3.0
yarn --version:n/a

然后,指定:

Target Platform: UWP (developer mode enabled)

Target Platform Version(s):
10.0.10586
.NET 4.6.1, .NET 4.5

Target Device(s):
Mobile ARM

Development Operating System:
Windows 10 Desktop

Visual Studio Version:
Visual Studio 2015
Visual Studio 2017

复制步骤

  • 初始化新的 react-native 项目(react-native init project_name)
  • cd 到 project_name
  • npm install rnpm-plugin-windows
  • 反应原生窗口
  • 打开视觉工作室
  • 在 Visual Studio 中打开 .sln 文件
  • 将设备连接到机器
  • 更改 deviceServerHelper,cs 以指向机器的 ip 地址
  • 在调试模式下运行指向设备和 ARM 架构的项目
  • 应用程序在手机上启动并显示错误消息
  • 在项目根目录的命令提示符下运行 react-native start to 启动打包器
  • 显示重新加载 javascript 错误消息

预期行为

应用应该加载到显示 index.windows.js 页面内容的屏幕上

实际行为

提示无法下载 JS Bundle 的错误消息。

可重现的演示

(将链接粘贴到示例项目和重现问题的确切说明。) https://github.com/ballySingh/repo2.git

下载 zip 并运行 npm install。请按照上面复制部分的第 4 步操作。

【问题讨论】:

    标签: react-native uwp windows-10-mobile mobile-development react-native-windows


    【解决方案1】:

    当我在连接到我的工作 VPN 时运行 react 本机打包程序时遇到了这个问题,一旦我断开我的工作 VPN 连接,打包程序就能够为我的应用程序选择正确的 IP 接口。如果您已连接到 VPN,请断开连接并再次运行您的打包程序。

    【讨论】:

      【解决方案2】:

      尝试将 localhost 字符串更改为您的真实 IP

      private const string DeviceLocalhost = "localhost:8081"

      在文件中

      C:\git\plex\plant-floor-app\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\DevSupport\DevServerHelper.cs

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-05-24
        • 1970-01-01
        • 2019-03-22
        • 1970-01-01
        • 2019-12-22
        • 1970-01-01
        • 2017-10-12
        • 2015-12-23
        相关资源
        最近更新 更多