[FIXED] WebGL export failure: FileNotFoundException

Hi guys,

since Unity has released WebGL as an available platform I couldn’t export any project as WebGL.
I even tried to build an empty project with just one empty scene without any asset, and I always get the following error:

FileNotFoundException: Temp/StagingArea/Data\Desktop.js.mem does not exist
System.IO.File.Move (System.String sourceFileName, System.String destFileName) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:318)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:357)
UnityEditor.PostprocessBuildPlayer.Postprocess (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) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
UnityEditor.HostView:OnGUI()

I’m on Windows 10, using the latest Unity version.

Does anyone know how to fix it?

Thanks in advance.

I am on Windows 10 and I can build with no problems with Unity 5.3.5 ? Could you please try again to create a new project, build, then post your Editor log here ? (should be in C:\Users<username>\AppData\Local\Unity\Editor)

Here, the Edito log. I can’t see anything wrong until the error comes out.

Launched and connected shader compiler UnityShaderCompiler.exe after 0.050000 seconds

Textures      0.0 kb     0.0%
Meshes        0.0 kb     0.0%
Animations    0.0 kb     0.0%
Sounds        0.0 kb     0.0%
Shaders       0.0 kb     0.0%
Other Assets  0.3 kb     0.0%
Levels        1.8 kb     0.0%
Scripts       445.0 kb     9.9%
Included DLLs 3.9 mb     89.8%
File headers  12.4 kb     0.3%
Complete size 4.4 mb     100.0%

Used Assets and files from the Resources folder, sorted by uncompressed size:
4.0 kb     0.1% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll
1.8 kb     0.0% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll
0.1 kb     0.0% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll
0.1 kb     0.0% C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll
Invoking UnusedByteCodeStripper2 with arguments: -out "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed\tempStrip" -l none -c link -b False -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Core.xml" -f "C:\Program Files\Unity\Editor\Data\il2cpp\LinkerDescriptors" -x "C:\Users\Sergio\Documents\workspace\unity\testewebgl/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml" -x "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\preserved_derived_types.xml" -d "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed" -a  "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll"
C:\Program Files\Unity\Editor\Data\Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe exited after 1835 ms.
C:\Program Files\Unity\Editor\Data\Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe exited after 470 ms.
Invoking UnusedByteCodeStripper2 with arguments: -out "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed\tempStrip" -l none -c link -b False -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Core.xml" -f "C:\Program Files\Unity\Editor\Data\il2cpp\LinkerDescriptors" -x "C:\Users\Sergio\Documents\workspace\unity\testewebgl/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml" -x "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\preserved_derived_types.xml" -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Audio.xml" -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\TextRendering.xml" -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\UI.xml" -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Animation.xml" -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Physics2D.xml" -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\IMGUI.xml" -x "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Physics.xml" -d "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed" -a  "C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll"
C:\Program Files\Unity\Editor\Data\Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe exited after 2311 ms.
C:\Program Files\Unity\Editor\Data\Tools/InternalCallRegistrationWriter/InternalCallRegistrationWriter.exe exited after 384 ms.
Invoking il2cpp with arguments: --convert-to-cpp --copy-level=None --output-format=Compact --extra-types.file="C:\Program Files\Unity\Editor\Data\il2cpp\il2cpp_default_extra_types.txt"  --assembly="C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll" --assembly="C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\Managed\UnityEngine.dll" --generatedcppdir="C:\Users\Sergio\Documents\workspace\unity\testewebgl\Temp\StagingArea\Data\il2cppOutput"
C:\Program Files\Unity\Editor\Data\il2cpp/build/il2cpp.exe exited after 34724 ms.
Filename: "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport/BuildTools/Emscripten_Win/python/2.7.5.3_64bit/python.exe"
Arguments: "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport/BuildTools/Emscripten/tools/file_packager.py" "Desktop.data" --no-heap-copy --js-output="fileloader.js" --preload "data.unity3d" "methods_pointedto_by_uievents.xml" "preserved_derived_types.xml" "Il2CppData/" "Resources/unity_default_resources" "Resources/unity_builtin_extra" "Managed/mono/2.0/machine.config"
index: -1
Filename: "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport/BuildTools/Emscripten_Win/python/2.7.5.3_64bit/python.exe"
Arguments: "C:\Program Files\Unity\Editor\Data\PlaybackEngines\WebGLSupport/BuildTools/Emscripten/emcc" @"C:/Users/Sergio/Documents/workspace/unity/testewebgl/Assets/../Temp/emcc_arguments.resp"
index: -1
FileNotFoundException: Temp/StagingArea/Data\Desktop.js.mem does not exist
  at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x000bd] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:318
  at UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (BuildPostProcessArgs args) [0x00430] in /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:357
  at UnityEditor.PostprocessBuildPlayer.Postprocess (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) [0x000c5] in C:\buildslave\unity\build\Editor\Mono\BuildPipeline\PostprocessBuildPlayer.cs:316
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, BuildTarget, BuildOptions, Boolean, UInt32&)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions, Boolean) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:596)
UnityEditor.BuildPlayerWindow:BuildPlayerWithDefaultSettings(Boolean, BuildOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:441)
UnityEditor.BuildPlayerWindow:GUIBuildButtons(IBuildWindowExtension, Boolean, Boolean, Boolean, BuildPlatform) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1511)
UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1446)
UnityEditor.BuildPlayerWindow:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:1011)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:187)
UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:180)
UnityEditor.HostView:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:76)
(Filename: /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs Line: 318)

DisplayProgressNotification: Build Failed
Error building Player: FileNotFoundException: Temp/StagingArea/Data\Desktop.js.mem does not exist
(Filename:  Line: -1)

Load scene 'Temp/__Backupscenes/0.backup' time: 0.016185 ms
Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
System memory in use before: 37.2 MB.
System memory in use after: 37.3 MB.

Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 1925.
Total: 3.923889 ms (FindLiveObjects: 0.136980 ms CreateObjectMapping: 0.020922 ms MarkObjects: 3.757301 ms  DeleteObjects: 0.007500 ms)

Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
System memory in use before: 37.2 MB.
System memory in use after: 37.3 MB.

Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 1931.
Total: 7.182217 ms (FindLiveObjects: 0.309095 ms CreateObjectMapping: 0.030791 ms MarkObjects: 6.833251 ms  DeleteObjects: 0.007105 ms)

Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/Advertisements/UnityEngine.Advertisements.dll' because we're compiling for Editor
Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll' because we're compiling for Editor
Ignoring 'C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/UnityPurchasing/UnityEngine.Purchasing.dll' because we're compiling for Editor
Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
System memory in use before: 37.2 MB.
System memory in use after: 37.3 MB.

Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 1931.
Total: 3.643611 ms (FindLiveObjects: 0.193825 ms CreateObjectMapping: 0.024080 ms MarkObjects: 3.418994 ms  DeleteObjects: 0.005921 ms)

I fixed the error \o/.

I had an ambient variable called PYTHONPATH that addressed to another python 2.7 version in my pc. It seems that it bugs unity when it calls its own python version from its folder. Deleting my PYTHONPATH variable fixed the problem.