Sorry, the build\win_toolchain.json suggestion was a red herring.
The setup of paths (which is what we assume is going wrong here) is in build\vs_toolchain.py, so you may need to try debugging this. Sometimes the best way to get output from these scripts is to raise an exception - normal printing is swallowed in many cases. So, for instance, on my home (non-Google setup) machine I changed the print statement near the end of vs_toolchain.py to raise an exception containing the text instead of printing it:
raise Exception('''vs_path = "%s"
sdk_path = "%s"
vs_version = "%s"
wdk_dir = "%s"
runtime_dirs = "%s"
''' % (
NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']),
NormalizePath(os.environ['WINDOWSSDKDIR']),
GetVisualStudioVersion(),
NormalizePath(os.environ.get('WDK_DIR', '')),
os.path.pathsep.join(runtime_dll_dirs or ['None'])))
Then I ran gn gen (you can run it on an existing or non-existent directory, it doesn't matter). You can see my results below:
> gn gen out\release
Traceback (most recent call last):
File "C:/src/chromium/src/build/vs_toolchain.py", line 404, in <module>
sys.exit(main())
File "C:/src/chromium/src/build/vs_toolchain.py", line 400, in main
return commands[sys.argv[1]](*sys.argv[2:])
File "C:/src/chromium/src/build/vs_toolchain.py", line 388, in GetToolchainDir
os.path.pathsep.join(runtime_dll_dirs or ['None'])))
Exception: vs_path = "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
sdk_path = "C:\Program Files (x86)\Windows Kits\10"
vs_version = "2015"
wdk_dir = ""
runtime_dirs = "C:\Windows\Sysnative;C:\Windows\SysWOW64"
ERROR at //build/config/win/visual_studio_version.gni:27:7: Script returned non-zero exit code.
If your directories are different, or if your VS 14 or Windows Kits\10 directories don't contain all of the expected files, then that's the problem. If not, then, ...?