- Home /
Getting System.ComponentModel.Win32Exception (2): No such file or directory
I'm getting this error when building from unity webgl.
macos monterey 12.3
M1 macbookpro
unity 2020.3.11f1
System.ComponentModel.Win32Exception (2): No such file or directory at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at Unity.IL2CPP.Shell.SetupAndStart(ExecuteContext context, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 423 at Unity.IL2CPP.Shell.ExecuteAsync(ExecuteArgs executeArgs, IExecuteController controller, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 299 at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 355 at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 334 at Unity.IL2CPP.Building.ParallelFor.<>c_DisplayClass1_0`2.b_0(Object o) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/ParallelFor.cs:line 78
TIA. I hope someone can help me with this.
This happened when I upgrade my macos to the latest.
Exact same issue here with a fresh brand new project. I've been searching for a solution for 2 days and no luck so far.
Answer by M_R_Antonio · Mar 25 at 09:15 AM
The solution has already been found: https://forum.unity.com/threads/case-1412113-builderror-osx-12-3-and-unity-2020-3-constant-build-errors.1255419/
If anyone is wondering what it is, the workaround is to install Python 2.7.
I just had to build and tried the fix but it's still not working
yes, it is also not working when I tried the solution stated in the link.
After you install the phyton 2.7
create a class like this and it will have a successful build. found the solution in the above link. I already tried it and it works.
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
public class PreBuildProcessing : IPreprocessBuildWithReport
{
public int callbackOrder => 1;
public void OnPreprocessBuild(BuildReport report)
{
System.Environment.SetEnvironmentVariable("EMSDK_PYTHON", "/Library/Frameworks/Python.framework/Versions/2.7/bin/python");
}
}
#endif
Answer by adowtatepmar · Mar 22 at 05:39 PM
Unfortunately I'm also having the same issue.
M1 Pro Macbook Pro 14"
Monterey 12.3
Unity 2020.3.31f LTS
System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Unity.IL2CPP.Shell.SetupAndStart(ExecuteContext context, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 423
at Unity.IL2CPP.Shell.ExecuteAsync(ExecuteArgs executeArgs, IExecuteController controller, Boolean asyncMode) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 299
at Unity.IL2CPP.Shell.Execute(ExecuteArgs executeArgs, IExecuteController controller) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Shell/Shell.cs:line 355
at Unity.IL2CPP.Building.CppProgramBuilder.ProvideObjectFile(IntermediateObjectFileCompilationData data) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 334
at Unity.IL2CPP.Building.ParallelFor.<>c__DisplayClass1_0`2.<RunWithResult>b__0(Object o) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Building/ParallelFor.cs:line 78
Answer by JanosSimay · Mar 24 at 04:30 PM
Hi,
I faced the same issue with the LTS versions. As I am using an M1 PRO 14" MacBook I gave a try to the latest official silicon editor - even if it is not an LTS - and it worked just fine.
OS: macOS Monterey 12.3 Unity Editor: 2021.2.16f1 Silicon
I hope this helps.
Jani
The problem is that upgrading version from 2020 to 2021 may bring issues and it's not that simple to upgrade a project.
Answer by nanohazard · Mar 25 at 03:52 AM
Thank you all for the response. I tried the workaround on my project but it is not compatible or there is new error thrown when I update it in 2021.2.16f1.
If no luck or no fixes on this issue, It is better to do it on windows pc/laptop.