Can't Build WebGL when can do on other platform

Hi, i will try explain in short and informative.
Does anyone know how to fix failed when build in WebGL? any response would be appreciated!

-I used unity 2020.2.x and i can build .exe for play on windows with no problem.
-when i try Switch and build in WebGL i got
“Exception: Unity.IL2CPP.Building.BuilderFailedException: Traceback”
and tell me something wrong about Emscripten and few python file(like, emcc.py,etc).
for full error detail please take a look text file i attached.

yesterday,I took a whole day try google and fix but i can’t
things i try so far:

  • reinstall unity and retry → failed
  • downgrade for few version like 2020.1.x → failed
  • change unity to run as administrator → failed
  • change build directory to C: and other drive → failed
  • check my path is no non-latin character → failed
  • check the path that file exists and yes it is → failed
    - even try to build new project with just 1 cube Still failed! (same error just different path)
  • and so much many thing i can’t remember >x<".
    actually, it not necessary now to build as WebGL platform i but i just want to fix it. also it’s good to know how to fix for my future project.

------------if you don’t want to click the file then this below-----------
Exception: Unity.IL2CPP.Building.BuilderFailedException: Traceback (most recent call last):
File “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py”, line 3063, in
sys.exit(run())
File “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py”, line 1521, in run
compile_source_file(i, input_file)
File “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\emcc.py”, line 1513, in compile_source_file
if run_process(args, check=False).returncode != 0:
File “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\shared.py”, line 167, in run_process
return run_base(cmd, universal_newlines=universal_newlines, check=check, *args, **kw)
File “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\shared.py”, line 158, in run_base
proc = Popen(cmd, *args, **kw)
File “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\lib\subprocess.py”, line 711, in init
errread, errwrite)
File “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\lib\subprocess.py”, line 948, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

Invocation was: Executable: “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe”
Arguments: -E “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\em++” -Wno-unused-value -Wno-invalid-offsetof -nostdinc -fno-strict-overflow -Wno-null-conversion -std=c++11 -O3 -Oz -DIL2CPP_EXCEPTION_DISABLED=1 -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER_DISABLED -DGC_NOT_DLL -DRUNTIME_IL2CPP -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DNDEBUG -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\libil2cpp" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\libil2cpp" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\bdwgc\include" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\xxHash" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\baselib\Include" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\external\baselib\Platforms\WebGL\Include" -I"X:\Unity\2020.2.4f1\Editor\Data\il2cpp\libil2cpp\pch" -I"X:\UnityProject\TestWebGL\Library\Il2cppBuildCache\WebGL\il2cppOutput" “X:\UnityProject\TestWebGL\Library\Il2cppBuildCache\WebGL\il2cppOutput\Il2CppCCalculateFieldValues.cpp” -o “X:\UnityProject\TestWebGL\Library\il2cpp_cache\88D4FB5475660F03317AD1FD1B3D06AB.o”

at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector) at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection1 matchedAssemblyMethodSourceFiles)
at il2cpp.Program.DoRun(String[ ] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions)
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at :0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <afa9f07022084fb2b65f56c776d2e220>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo, System.String generatedCppOutputDirectory) (at <afa9f07022084fb2b65f56c776d2e220>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.Boolean platformSupportsManagedDebugging) (at <afa9f07022084fb2b65f56c776d2e220>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <afa9f07022084fb2b65f56c776d2e220>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at :0)
UnityEditor.WebGL.WebGlBuildPostprocessor.CompileBuild (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:365)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:910)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at :0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

6838169–795737–Unity WebGL Error.txt (5.51 KB)

The error here seems to be

WindowsError: [Error 2] The system cannot find the file specified

Invocation was: Executable: “X:\Unity\2020.2.4f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe”

That is, Emscripten is unable to find python executable in that path. Can you confirm that it exists? I wonder if this is a somehow partial installation that occurred.

Thank you for your response!
I already did that and they all exist! sooo confused
Please take a look on topic “things i try so far” above for more detail what i already try to fix:)

6845597--797072--upload_2021-2-17_11-39-45.png

should i do clean reinstall?

Thanks for double checking, and sorry for missing the original confirmation in your first post.

Actually, now that I look closer in the callstack, the issue is not that python would not be found. The code is already executing emcc.py using python, and it is emcc.py that is unable to execute a clang to compile a file.

Some things that come to mind to test:

  1. If you repeat this set of commands, does that all look the same? (replace the directory with your path to Unity)

  1. Set the global persistent Windows Environment variable “EMCC_DEBUG=1” (not just a command prompt local set), e.g. see How to Set the Path and Environment Variables in Windows for the dialog to find it. Then close Unity and Unity Hub, reopen and rebuild. Does that print more information to the log? In particular I am curious what the path name is that emcc.py prints out at line 1512 of emcc.py

  2. You are running 64-bit Windows, right? (you can double check with Windows+Pause → System type: should read "64-bit Operating System). The compiler executables that are shipped for WebGL only support 64-bit OSes.

here’s the Result after I try according your 3 instruction…

  1. repeat set of commands it does look all the same.
  2. in the Windows Environment variable I can’t find the variable “EMCC_DEBUG=1”
  3. Yes, I run 64 bit.

furthermore, I wanna add up to you that I used to build WEBGL successfully before i used 2020.x.x

and again Thank you for your support!

To all who have same problem as mine.

Only solution i found out now is “Build it On another computer”

so i quite sure now it’s not from my code or asset…

anyway, i still need help here. and wanna know how to correctly fix this.

any response would be appreciated!

To all checking this post :

I still have this problem and don’t know other ways to fix it than above.

any ideas?

thx :slight_smile:

To all checking this post :

sry for necro this thread but I still have this problem and don’t know other ways to fix it than above.

Please help me.

thank you.

I’m having this same issue, can we have some help, please?

Also having the issue, can’t build WebGL on Windows

Or you may try to change the platform. Qform as an alternative can work better for you. Especially, if you are planning to create feedback polls for your users on your website.

I am having the same problem. But on mac platform. I couldn’t solve the problem :frowning: