WebGL build error in 5.6 problem with python script

Unity recently added official Facebook WebGL and gameroom support, which is something that is greatly appreciated. I updated my project and built a WebGL build (which previously built just fine normally) to find it spit out an error and not make any files because the build failed. I’ve read around and apparently back in 2015 people were getting a similar error, so I’ve been trying every fix I can find in the book.

I’ve moved my project folder, messed with my environment variables, ran as administrator, downloaded the beta versions and tried them, installed python files, deleted python files, nothing seems to work. My game used to build to WebGL just fine because my team has been looking to focus on web development, and this has really just thrown a wrench in our plans. If anybody can decipher or send me a link to a thread where this was solved I would be very grateful, I’ve been googling for days.

Here’s the two errors I get in the unity window when it finishes building:

Exception: Failed building WebGL Player.
UnityEditor.WebGL.ProgramUtils.StartProgramChecked (System.Diagnostics.ProcessStartInfo p) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/ProgramUtils.cs:48)
UnityEditor.WebGL.WebGlBuildPostprocessor.EmscriptenLink (BuildPostProcessArgs args, Boolean wasmBuild, System.String sourceFiles, System.String sourceFilesHash) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:394)
UnityEditor.WebGL.WebGlBuildPostprocessor.LinkBuild (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:437)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:872)
UnityEditor.Facebook.BuildProcessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/Facebook/Extensions/Managed/BuildProcessor.cs:117)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:186)
UnityEditor.HostView:OnGUI()

and the second:

Failed running "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe" "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc" @"D:\GrenadeTree\DuckDodge\Duck n' Dodge\Assets\..\Temp\emcc_arguments.resp"

stdout:
stderr:WARNING:root:--separate-asm works best when compiling to HTML. otherwise, you must yourself load the '.asm.js' file that is emitted separately, and must do so before loading the main '.js` file
error: failure to execute js library "D:\GrenadeTree\DuckDodge\Duck n' Dodge\Assets\Plugins\WebGL\HandleIO.jslib": SyntaxError: Unexpected token {,,SyntaxError: Unexpected token {    at Object.LibraryManager.load (eval at globalEval (D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js:105:8), <anonymous>:173:14)    at JSify (eval at globalEval (D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js:105:8), <anonymous>:59:20)    at D:\GrenadeTree\DuckDodge\Duck n' Dodge\Assets\Plugins\WebGL\HandleIO.jslib (D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js:208:3)    at Module._compile (module.js:460:26)    at Object.Module._extensions..js (module.js:478:10)    at Module.load (module.js:355:32)    at Function.Module._load (module.js:310:12)    at Function.Module.runMain (module.js:501:10)    at startup (node.js:129:16)    at node.js:814:3preprocessed source (you can run a js engine on this to get a clearer error message sometimes):=============var HandleIO = {	SyncFiles : Function () {		FS.syncfs(false, function (err) {			//handle callback		});	}}mergeInto (LibraryManager.library, HandleIO)=============Internal compiler error in src/compiler.js! Please raise a bug report at https://github.com/kripken/emscripten/issues/ with a log of the build and the input files used to run. Exception message: "SyntaxError: Unexpected token {" | SyntaxError: Unexpected token {    at Object.LibraryManager.load (eval at globalEval (D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js:105:8), <anonymous>:173:14)    at JSify (eval at globalEval (D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js:105:8), <anonymous>:59:20)    at Object.<anonymous> (D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js:208:3)    at Module._compile (module.js:460:26)    at Object.Module._extensions..js (module.js:478:10)    at Module.load (module.js:355:32)    at Function.Module._load (module.js:310:12)    at Function.Module.runMain (module.js:501:10)    at startup (node.js:129:16)    at node.js:814:3Traceback (most recent call last):
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc", line 13, in <module>
    emcc.run()
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py", line 1661, in run
    final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten	ools\shared.py", line 1745, in emscripten
    call_emscripten(cmdline)
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 1842, in _main
    temp_files.run_and_clean(lambda: main(
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten	ools	empfiles.py", line 78, in run_and_clean
    return func()
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 1847, in <lambda>
    DEBUG=DEBUG,
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 1748, in main
    temp_files=temp_files, DEBUG=DEBUG)
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 93, in emscript
    glue, forwarded_data = compiler_glue(metadata, settings, libraries, compiler_engine, temp_files, DEBUG)
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emscripten.py", line 296, in compiler_glue
    cwd=path_from_root('src'), error_limit=300)
  File "D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten	ools\jsrun.py", line 122, in run_js
    raise Exception('Expected the command ' + str(command) + ' to finish with return code ' + str(assert_returncode) + ', but it returned with code ' + str(proc.returncode) + ' instead! Output: ' + str(ret)[:error_limit])
Exception: Expected the command ['D:/Program Files (x86)/Unity/Editor/Data\\Tools\

odejs
ode.exe’, ‘–stack_size=8192’, ‘–max-old-space-size=2048’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\compiler.js’, “D:\GrenadeTree\DuckDodge\Duck n’ Dodge\Temp\EmscriptenTemp\ mpwmmmbe.txt”, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Audio.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Cursor.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Eval.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\FileSystem.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Logging.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Profiler.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\SystemInfo.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\UnetWebSocket.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\Video.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\WebCam.js’, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\lib\WebRequest.js’, “D:\GrenadeTree\DuckDodge\Duck n’ Dodge\Assets\Plugins\WebGL\HandleIO.jslib”, “D:\GrenadeTree\DuckDodge\Duck n’ Dodge\Assets\Plugins\WebGL\GameSparks.jslib”, “D:\GrenadeTree\DuckDodge\Duck n’ Dodge\Assets\Plugins\WebGL\GameAnalyticsUnity.jslib”, ‘D:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\library_pthread_stub.js’] to finish with return code 0, but it returned with code 1 instead! Output: // The Module object: Our interface to the outside world. We import
// and export values on it, and do the work to get that through
// closure compiler if necessary. There are various ways Module can be used:
// 1. Not defined. We create it here
// 2. A function parameter, function(Module) { …gener
UnityEditor.HostView:OnGUI()

Is the new unity installer missing some file, or changed one it needs for webGL? I’m almost considering reverting back to an old version and just building for facebook the old way so it will work. Also, here’s a link to where my game is now for the curious: Duck n' Dodge Windows, Mac, iOS, Android game - Indie DB

Looks like the problem might be in HandleIO.jslib:

HandleIO.jslib": SyntaxError: Unexpected token {,

Same issue on my side :frowning:

Aha, I have finally fixed my issue after many hours of reinstalling and testing webGL builds.
My issue was in a file: Plugins/WebGL/HandleIO.jslib, and when I removed it the game was able to make a build. Finally!

It actually mentioned that file in my error log I had posted, but I thought it was a file inside of the python folders, turns out it wasn’t. So if you have that error, try and search for that file, it seems to wreck stuff.

The solution is here!