Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

WebGL build failed - Unity looking for wrong version of Emscripten?

Discussion in 'WebGL' started by AnthonyPalma, Feb 12, 2020.

  1. AnthonyPalma

    AnthonyPalma

    Joined:
    Aug 11, 2013
    Posts:
    128
    Hello! I'm having an issue building to WebGL (both my existing project and a new blank project). Part of the output of the error says it can't find a version of Emscription (1.29.0) on my computer, which is true - my PC has 1.35.9 installed. The problem is, I can't install 1.29.0 via command line because the Emscripten repo seems to no longer exist (you can try for yourself by following the steps here).

    Any ideas on what I can do to fix this? I am on Windows 10 and have tried this with Unity 2019.2.13 and 2019.3.0 with the same result. Thanks in advance!

    Here's that part of the build output that I mentioned:

    stdout:
    Building build.bc with EmscriptenToolChain
    Output directory: C:\Users\CoreLabs\Unity Projects\2D Multiplayer Shooter\Temp\StagingArea\Data\Native
    Cache directory: C:\Users\CoreLabs\Unity Projects\2D Multiplayer Shooter\Library\il2cpp_cache
    il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: C:\Program Files\Unity\Hub\Editor\2019.3.0f6\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten_Win\python\2.7.5.3_64bit\python.exe: can't open file 'C:\Program Files\Emscripten\emscripten\1.29.0\emcc': [Errno 2] No such file or directory
     
    DrViJ likes this.
  2. AnthonyPalma

    AnthonyPalma

    Joined:
    Aug 11, 2013
    Posts:
    128
    Quick update: I completely uninstalled and reinstalled Unity onto a completely different drive inside my PC, but I'm still getting the same error. Also now my VC Code code completion is broken haha. What a day!
     
  3. WilliamLeu

    WilliamLeu

    Joined:
    Jul 27, 2012
    Posts:
    19
    I was completely missing an Emscriptem folder in "Program Files". I fixed a similar issue by making the missing folders by hand in Program Files and copying the contents of "C:\Program Files\Unity\Hub\Editor\2019.4.7f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten" into that folder.

    Although, I'm somewhat mystified how I got to a state where Unity has the files it needs packaged within itself, but tries to reference it from a folder that doesn't exist.
     
  4. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    I just ran into something similar and am currently waiting for Unity to reinstall (I tried the wipe and start-over approach too). However my error message referenced a version of Emscripten that I used a few years ago, and I think that's a clue. I believe Unity Hub does not install Emscripten if it finds the system variables for an existing (or prior) installation.
    I've renamed all the system variables (by adding _tmp onto their names so I can reverse later if needed) and I will confirm or refute this theory in about 15 minutes after Unity reinstalls, and I add the dev studio patches, and wait for the project to do whatever it is that takes so long the first time you load it, then wait 5-10 minutes for the webgl build.
     
    Last edited: Sep 3, 2021
  5. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    Yes, that worked. Make sure you get all the system variables and all the path entries (there are 4-5 of each) from any old installation... then Unity will use the one it installed.