react-native-windows icon indicating copy to clipboard operation
react-native-windows copied to clipboard

Facebook.Yoga.YogaConfig threw an exception

Open markhomoki opened this issue 8 years ago • 21 comments

Environment

  1. react-native -v: react-native-cli: 2.0.1 react-native: 0.55.4

  2. npm ls rnpm-plugin-windows: [email protected]

  3. npm ls react-native-windows: [email protected]

  4. node -v: v8.11.1

  5. npm -v:

  6. yarn --version: 1.6.0

Then, specify:

  • Target Platform: WPF
  • Target Platform Version(s): .NET 4.6.0 WPF
  • Target Device(s): Desktop
  • Development Operating System: Windows 10.1 Pro
  • Visual Studio Version: 2017

Steps to Reproduce

  1. react-native init test
  2. cd test
  3. npm install --save-dev rnpm-plugin-windows
  4. npm install react-native
  5. react-native wpf
  6. npm install
  7. works fine on local development
  8. build and publish it via Visual Studio 2017
  9. creates a setup file, runs on local machine works fine
  10. tries on another machine, the setup installs the files but when it runs shows an error

Expected Behavior

When runs on another machine should work the same way as on my machine.

Actual Behavior

Works fine on my machine but not on others. Shows the following error: The type initializer for Facebook.Yoga.YogaConfig threw an exception

image

markhomoki avatar May 30 '18 15:05 markhomoki

Seems like a compatibility issue with yoga.dll. What are details for the other computer you are trying to run on?

rozele avatar May 30 '18 15:05 rozele

Thank you for your answer. The other PC I tried on is Windows 8.1 Pro with .NET 4.6.

markhomoki avatar May 30 '18 16:05 markhomoki

Are both x64 (or did you compile for x86)?

rozele avatar May 30 '18 16:05 rozele

Both PC are x64 and the app is compiled for x64 as well. Using DebugBundle to see the error, I tried ReleaseBundle as well but had the same issue without the red screen.

markhomoki avatar May 30 '18 16:05 markhomoki

@markhomoki - yoga targets vcruntime140.dll / msvcp140.dll - is that available in c:\Windows\System32 on your Windows 8.1 machine?

rozele avatar May 30 '18 16:05 rozele

Good spot, thanks. I have it on my machine, but its not on the 8.1 machine.

markhomoki avatar May 30 '18 16:05 markhomoki

Any idea how can install with the bundle?

markhomoki avatar May 30 '18 16:05 markhomoki

I would think this would be included in a Windows update, but if not you can install Microsoft Visual C++ 2015 Redistributable. Not sure the about the right way to package this up in an installer for Windows 8.1.

rozele avatar May 30 '18 16:05 rozele

So I tried on another Windows 10.1 Pro machine where those 2 files have been installed and still got the same error. On the Windows 8.1 I installed the Microsoft Visual C++ 2015 Redistributable and still have the same error. However on my machine still works fine.

markhomoki avatar May 30 '18 17:05 markhomoki

Quick update: managed to run the app on another PC when Windows 10 SDK was installed. This is 1.6GB with the required files so it's not an option. From the installed files I could figure out that it only requires Universal CRT tools x86 which is only 700kb.

I found this online on MS website:

Updated September 11, 2015: App-local deployment of the Universal CRT is supported. To obtain the binaries for app-local deployment, install the Windows Software Development Kit (SDK) for Windows 10. The binaries will be installed to C:\Program Files (x86)\Windows Kits\10\Redist\ucrt. You will need to copy all of the DLLs with your app (note that the set of DLLs are necessary is different on different versions of Windows, so you must include all of the DLLs in order for your program to run on all supported versions of Windows)

I added the required dlls and published with the app as detailed above but unfortunately still does not run. Question is how to bundle it with the app?

markhomoki avatar May 31 '18 10:05 markhomoki

I'm confused why it would need to be bundled with the Universal CRT if you are building it for WPF / Desktop.

rozele avatar May 31 '18 12:05 rozele

@markhomoki - can you find your build output directory and run:

dumpbin /dependents yoga.dll

I'm still confused why the Universal CRT would be req'd.

rozele avatar May 31 '18 18:05 rozele

I am not sure either. This is the output of dumpbin:

Dump of file yoga.dll

File Type: DLL

  Image has the following dependencies:

    MSVCP140D.dll
    VCRUNTIME140D.dll
    ucrtbased.dll
    KERNEL32.dll

  Summary

        1000 .00cfg
        1000 .data
        1000 .idata
        8000 .rdata
        2000 .reloc
        1000 .rsrc
       36000 .text
       18000 .textbss

markhomoki avatar Jun 04 '18 11:06 markhomoki

I have developed a react-native-windows WPF app targeting win7 machine. I developed this app on win10 with VS 2017 community edition. App works fine on my machine and teammate machine with VS development environment but it give the same error "Facebook.Yoga.YogaConfig threw an exception" when running on another non-dev machine of windows 7 and windows 10. Find below the dependents of yoga.dll and suggest do I need to copy "Universal CRT tools x86" on windows 7 machine as well:

Visual Studio 14.0\VC\bin\dumpbin.exe" /dependents yoga.dll Microsoft (R) COFF/PE Dumper Version 14.00.24210.0 Copyright (C) Microsoft Corporation. All rights reserved.

Dump of file yoga.dll

File Type: DLL

Image has the following dependencies:

MSVCP140D.dll
VCRUNTIME140D.dll
ucrtbased.dll
KERNEL32.dll

Summary

    1000 .00cfg
    1000 .data
    2000 .idata
    5000 .pdata
   12000 .rdata
    1000 .reloc
    1000 .rsrc
   3C000 .text
   1A000 .textbss

praveen4zenith avatar Jun 04 '18 12:06 praveen4zenith

@markhomoki @ncomo11 Maybe the problem is with the D (e.g., MSVCP140D.dll). Can you try running release builds on other machines? Perhaps the debug DLLs are only available if you have Visual Studio installed.

rozele avatar Jun 04 '18 17:06 rozele

@rozele Thanks 👍 , Release build worked on my windows 7 non-development machine. Though I have to fix another issue while creating a release build which was already reported and luckily has a fix as well :

"ReactNative.Net46 project cannot be compiled with Release mode" - https://github.com/Microsoft/react-native-windows/issues/1819

praveen4zenith avatar Jun 05 '18 07:06 praveen4zenith

Closing, as the issue was with Debug builds.

rozele avatar Jun 05 '18 13:06 rozele

Hi, I am facing the issue in creating exe in Release Bundle mode. Its works fine in Debug mode. can someone please help me on the same. Error Log:

13 verbose stack at emitTwo (events.js:126:13) 13 verbose stack at EventEmitter.emit (events.js:214:7) 13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at emitTwo (events.js:126:13) 13 verbose stack at ChildProcess.emit (events.js:214:7) 13 verbose stack at maybeClose (internal/child_process.js:925:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) 14 verbose pkgid [email protected] 15 verbose cwd D:\Users\anaanand\Desktop\Ausnet-NVC-Code\CEOTMobile 16 verbose Windows_NT 6.1.7601 17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" 18 verbose node v8.11.3 19 verbose npm v5.6.0 20 error code ELIFECYCLE 21 error errno 11 22 error [email protected] start: node node_modules/react-native/local-cli/cli.js start 22 error Exit status 11 23 error Failed at the [email protected] start script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 11, true ]

AnandMM avatar Jul 05 '18 15:07 AnandMM

Have tried this: https://github.com/Microsoft/react-native-windows/issues/1819

praveen4zenith avatar Jul 06 '18 04:07 praveen4zenith

Hi Rozele, my exe does not work on wind 8.1, could you pls help me.

AnandMM avatar Jul 07 '18 02:07 AnandMM