Html5 packaging fails

I am trying to package an architectural visualization to html5, and the process freezes when the following log entries have appeared in the log:

UATHelper: Packaging (HTML5): HTML5Platform.Package: HTML5Platform.Automation: TargetWasm = False
UATHelper: Packaging (HTML5): HTML5Platform.Package: HTML5Platform.Automation: TargetWebGL2 = True
UATHelper: Packaging (HTML5): HTML5Platform.Package: HTML5Platform.Automation: Compressed = False
UATHelper: Packaging (HTML5): HTML5Platform.Package: HTML5Platform.Automation: EnableIndexedDB = False
UATHelper: Packaging (HTML5): CommandUtils.Run: Run: C:\Program Files\Epic Games\UE_4.17\Engine\Extras\ThirdPartyNotUE\emsdk\Win64\python\2.7.5.3_64bit\python.exe “C:\Program Files\Emscripten\emscripten\1.35.0\tools\file_packager.py” “F:\UNREAL\MyHouse\Binaries\HTML5\MyHouse.data” --preload . --js-output=“F:\UNREAL\MyHouse\Binaries\HTML5\MyHouse.js” --no-heap-copy

I have emscripten 1.35.0 installed in my Windows 10 system- I wonder if that is what’s causing the failure? Other prerequisites of html5 packaging may also be missing, or incorrectly installed or configured- all in all, packaging appears to be such a complicated process, that new users of Unreal would need instruction devoted entirely to packaging.

Having a separate Emscripten installed on your system can conflict if you have set the installation to install “system wide”, i.e. with EMSDK environment variable registered in the system. If that is the case, UE4 will attempt to use that one instead, and there will be messages in the build log saying something along those lines. It looks like that might be the case here. You do not need to uninstall Emscripten SDK to remedy, but you should remove the global EMSDK environment variable when running with UE4.

Btw, Emscripten 1.35.0 is currently ancient, and that was the last version that had NSIS installer support, after that Emscripten migrated to using portable zip installer also on Windows, to make the installation process more unified across Windows, Linux and OS X. Installing a newer Emscripten version over 1.35.0 will get tons of improvements.

I first tried packaging without Emscripten, but the process got stuck in the cooking stage. So I suppose a better course of action would be to install the newest Emscripten. The installation of that utility didn’t work using the instructions provided at the download page, but that isn’t an Unreal issue. The installer tries to use a folder named “zips” that isn’t in the package- it comes with the old Emscripten, but not the new one. Can anyone help with the proper installation and configuration of Emscripten?

The installation instructions are available at Download and install — Emscripten 3.1.39-git (dev) documentation. It is advised to not install to Program Files, because Windows limits regular user privileges from making modifications there, so you’d have to run as Administrator. If you have earlier NSIS based Emscripten SDK installed first, it is recommended to uninstall that first.

However Unreal Engine 4 should not need a custom Emscripten SDK, but the one bundled with UE4 should work fine. Just make sure not to have EMSDK environment variable set when running UE4 to make it pick up the bundled one.

Thank you. One last question: where is the EMSDK environment variable that needs to be unset- is it in Windows OS, or Mozilla Firefox, or Unreal Engine?

It is in Windows: see How to Set the Path and Environment Variables in Windows

In the Program Files folders of Unreal, I found a folder containing Emscripten, and created a Windows global environment variable with the following path:

C:\Program Files\Epic Games\UE_4.17\Engine\Extras\ThirdPartyNotUE\emsdk\emscripten\1.37.9

Apparently the path is wrong, because when packaging I got this:

LogHttp: Warning: 000002CB0B013280: request failed, libcurl error: 6 (Couldn’t resolve host name)
LogHttp: Warning: 000002CB0B013280: libcurl info message cache 0 (Could not resolve host: datarouter.ol.epicgames.com)
LogHttp: Warning: 000002CB0B013280: libcurl info message cache 1 (Closing connection 2)
LogHttp: Warning: 000002CB43F4F580: request failed, libcurl error: 6 (Couldn’t resolve host name)
LogHttp: Warning: 000002CB43F4F580: libcurl info message cache 0 (Could not resolve host: datarouter.ol.epicgames.com)
LogHttp: Warning: 000002CB43F4F580: libcurl info message cache 1 (Closing connection 3)

If the root of the problem lies in the EMSDK environment variable, can it be set to the Emscripten that was installed alongside Unreal in Unreal’s folders, or is there another resource in the Unreal folders that it can be set to?

Those messages look like warnings about some telemetry uploads to epicgames servers I think, and do not look like they would relate to the problem at hand here. Perhaps there is some other error message that was missed that would have given some more clues.

It should not be necessary to add custom environment variables that point back to inside UE4’s own copy of Emscripten SDK, that might even confuse UE4, since I don’t think anyone has tested that kind of flow. To use UE4’s own copy of Emscripten SDK, the intention is to run without EMSDK environment variable set at all.