Cannot build electron on windows: WindowsError: [Error 2] The system cannot find the file specified


#1

Hello guys.

I’m trying to rebrand electron for my application and I’m facing an issue. I have installed git, python2.7, VS 2013 Ultimate, and I’m using windows 8.1. Some clue on what I should do? Thanks.

C:\Users\tboga_000\Copy\electron-master>python .\script\build.py
Traceback (most recent call last):
  File ".\script\build.py", line 45, in <module>
    sys.exit(main())
  File ".\script\build.py", line 25, in main
    ret = subprocess.call([ninja, '-C', build_path, args.target])
  File "C:\Python27\lib\subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

#2

Update : I put Ninja on the path of python and aparently the script can read it. still I got a similar error:

Traceback (most recent call last):
  File "script\build.py", line 45, in <module>
    sys.exit(main())
  File "script\build.py", line 25, in main
    ret = subprocess.call([ninja, '-C', build_path, args.target])
  File "C:\Python27\lib\subprocess.py", line 486, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Python27\lib\subprocess.py", line 672, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 882, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

Please HELP!!!


#3

Had the same issue. Couldn’t get this running in the windows command prompt or powershell. I have git bash installed so tried it from there using / instead of \.
At the moment it’s compiling away. Will let you know if it completes.


#4

Update. Got bootstrap.py to compile on the second attempt (not sure what failed first go but it was pulling in updates and unzipping them). Now build.py is building, will keep you posted.


#5

Ok. All built at this stage. Switch to the git bash and try again. :slight_smile:


#6

I think the problem is in get_vs_location() inside script\lib\env_util.py in the build package. The code there doesn’t bear any resemblance to how Visual Studio is installed under Windows.

    program_files = os.environ.get('ProgramFiles(x86)')
    # Find visual studio
    proc = subprocess.Popen(
      program_files + "\\Microsoft Visual Studio\\Installer\\vswhere.exe "
      "-property installationPath "
      "-requires Microsoft.VisualStudio.Component.VC.CoreIde "
      "-format value "
      "-version {0}".format(vs_version),
      stdout=subprocess.PIPE)

    location = proc.stdout.readline().rstrip()
    return location

First, it’s “Program Files(x86)”, not “ProgramFiles(x86)”.

Second, the installation isn’t inside “Microsoft Visual Studio,” since that folder has a version number appended to it. vswhere.exe (whatever that is) isn’t required, since a quick review of SET results in a VS command window shows

VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 14.0\

available and ready for use.

But right now this is a guess–I’m going to hack env_util.py to see if I can get past this problem. I’ll follow with another post in a little while.


#7

Okay, in a long while. It took me more time than I thought to work around this because I’m not a Python programmer by trade.


#8

Most of the Python code attempting to determine which version of Visual Studio is available keeps looking for “InstallDir,” which isn’t anywhere in any version of Visual Studio I have installed. There are plenty of other environmental cues based on starting from inside a VS command box, so I’m reworking this build script to utilize those. I don’t think I’m going to do a PR on this, though.