简体   繁体   English

无法在 UWP React Native 上下载 JS 包

[英]Unable to download JS bundle on UWP React Native

Environment环境

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

Then, specify:然后,指定:

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

Steps to Reproduce重现步骤

  • initialize new react-native project (react-native init project_name)初始化新的 react-native 项目(react-native init project_name)
  • cd into project_name cd 到 project_name
  • npm install rnpm-plugin-windows npm 安装 rnpm-plugin-windows
  • react-native windows反应原生窗口
  • open visual studio开放视觉工作室
  • open .sln file in visual studio在 Visual Studio 中打开 .sln 文件
  • connect device to machine将设备连接到机器
  • change deviceServerHelper,cs to point to ip address of machine将 deviceServerHelper,cs 更改为指向机器的 IP 地址
  • run project in debug mode pointing to device and ARM architecture在调试模式下运行指向设备和 ARM 架构的项目
  • app launches on phone with error message应用程序在手机上启动并显示错误消息
  • in command prompt in project root directory run react-native start to start packager在项目根目录的命令提示符中运行 react-native start 启动打包程序
  • reload javascript error message displayed显示重新加载 javascript 错误消息

Expected Behavior预期行为

App should load on the screen showing the contents of index.windows.js page应用程序应加载到显示 index.windows.js 页面内容的屏幕上

Actual Behavior实际行为

Error message stating unable to download JS Bundle.错误消息指出无法下载 JS Bundle。

在此处输入图片说明

Reproducible Demo可重现的演示

(Paste the link to an example project and exact instructions to reproduce the issue.) https://github.com/ballySingh/repo2.git (粘贴示例项目的链接和重现问题的确切说明。) https://github.com/ballySingh/repo2.git

Download the zip and run npm install.下载 zip 并运行 npm install。 Please follow step 4 from the reproduction section, above.请按照上面复制部分的第 4 步操作。

Try change localhost string to your real IP尝试将 localhost 字符串更改为您的真实 IP

private const string DeviceLocalhost = "localhost:8081" <--- write your IP private const string DeviceLocalhost = "localhost:8081" <--- 写下你的IP

in file在文件中

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

I had this issue when I was running the react native packager while connected to my work VPN once I disconnected my work VPN connection the packager was able to pick up the correct IP interface for my app.当我在连接到我的工作VPN时运行 React Native 打包程序时遇到了这个问题,一旦我断开工作 VPN 连接,打包程序就能够为我的应用程序选择正确的 IP 接口。 If you are connected to VPN, please disconnect and run your packager again.如果您已连接到 VPN,请断开连接并再次运行您的打包程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM