0

I built a react-native app for Windows (https://github.com/Microsoft/react-native-windows). The app runs fine on my development machine, but if I copy the EXE (and DLL dependencies) to another machine and run, I get the error message

Unable to Download the JS bundle. Did you forget to start the development server or connect your device?

Is there a way to build a self-contained app that does not depend on a "development server"?

George
  • 2,436
  • 4
  • 15
  • 30

2 Answers2

0

You can bundle your JS code using

react-native bundle --platform windows --entry-file index.windows.js
--bundle-output windows\myapp\ReactAssets\index.windows.bundle
--assets-dest windows\myapp\ReactAssets
--dev false

If you want to upload to store then you can follow https://learn.microsoft.com/en-us/windows/uwp/packaging/packaging-uwp-apps#create-an-app-package

Ankit
  • 653
  • 2
  • 8
  • 18
  • Thank you, Ankit. This created a bundle file windows\myapp\ReactAssets\index.windows.bundle. What do I do with this bundle? I thought I could build an EXE that I could run on a non-development computer. – George Aug 02 '18 at 21:02
  • Hi @George I have the same question. I am successfully able to generate the bundle. Could you please help me with steps on how to generate release build .exe. I tried following - store > create Package > release - x86,x64 build. but when I run it tries to fetch bundle – ruyamonis346 Jun 27 '19 at 11:26
0

React Native Windows Environment Setup (with Typescript)

  1. Download and Install Visual Studio 2017 Download Link
  2. Download and Install Visual Studio Code Download Link
  3. Download and Install NodeJS Download Link
  4. Install React Native CLI

    npm i -g react-native-cli

  5. Install TypeScript

    npm i -g typescript

  6. Create your project

    react-native init --version="0.55.0-rc.0" MyApp --template typescript && node MyApp/setup.js

  7. Change project directory MyApp

    cd MyApp

  8. Install the React Native Windows CLI Plugin

    npm i --save-dev rnpm-plugin-windows

  9. Run the Windows initialization command

    react-native windows --windowsVersion 0.55.0-rc.0

  10. Open project MyApp.sln file in Visual Studio

  11. Follow the prompts to install the Windows 10 SDK v. 10.0.14393.0

  12. If prompted, select Developer Mode in the Settings window under "Use developer features" and approve the Certificate Installation request. Enable "Developer mode" to allow the custom application to run

  13. Install windows build tools (run in Windows Power Shell)

    npm i -g --production windows-build-tools

  14. Run your application

    react-native run-windows

  15. Prompt Windows PowerShell Installing Certificate: Enter Y to install

  16. Prompt window: Allow Access to windows firewall

Prabhu Manoharan
  • 311
  • 2
  • 10