Type something to search...

Electron Build Tools ERROR Error: Failed to run "choco install pywin32 --yes"

When working with Electron Build Tools, you might encounter an error related to the installation of pywin32 via Chocolatey. This can be frustrating, especially when it's a required dependency for your project. Below is a detailed explanation of the issue and potential steps to resolve it.

The Error

When initializing an Electron project using Electron Build Tools, you may see the following error message:

E:\>e init main-testing -i testing --root=e:/src/electron
WARN A fixable error has occurred
--> A required dependency "pywin32" could not be located, it probably has to be installed.
Do you want build-tools to try fix this for you? [y/n]: y

Running "choco install pywin32 --yes"
ERROR Error: Failed to run "choco install pywin32 --yes"
    at spawnSyncWithLog (C:\Users\zeeis\.electron_build_tools\src\utils\deps-check.js:11:11)
    at fix (C:\Users\zeeis\.electron_build_tools\src\utils\deps-check.js:39:9)
    at maybeAutoFix (C:\Users\zeeis\.electron_build_tools\src\utils\maybe-auto-fix.js:13:3)
    at whichAndFix (C:\Users\zeeis\.electron_build_tools\src\utils\which.js:10:5)
    at checkPlatformDependencies (C:\Users\zeeis\.electron_build_tools\src\utils\deps-check.js:61:7)
    at Object.<anonymous> (C:\Users\zeeis\.electron_build_tools\src\e-init.js:165:3)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)

This error typically occurs because the pywin32 package installation script cannot find the required files on the remote server. This results in a 404 error, indicating that the file is not available at the specified URL.

Understanding the Error

The key part of the error message is:

ERROR: The remote file either doesn't exist, is unauthorized, or is forbidden for url 'http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py3.9.exe/download'. Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (404) Not Found."

This indicates that the download URL for pywin32 is no longer valid, which means Chocolatey cannot retrieve the necessary installation files.

Troubleshooting Steps

Here are a few steps you can take to resolve this issue:

1. Verify Chocolatey Installation

Ensure that Chocolatey is installed correctly and updated to the latest version. You can check your Chocolatey version with:

choco --version

To update Chocolatey, use:

choco upgrade chocolatey

2. Manually Install pywin32

Since the automated installation is failing, try manually installing pywin32. You can download the appropriate version from the official pywin32 GitHub releases page and install it manually.

3. Modify the Installation Script

If you have control over the Electron Build Tools script, you can modify it to point to a valid URL for pywin32 or handle the manual installation process.

4. Use an Alternative Package Manager

If Chocolatey continues to fail, consider using an alternative package manager like pip for Python packages:

pip install pywin32

Example of Manually Installing pywin32

  1. Download the appropriate pywin32 installer from the official GitHub releases.
  2. Run the installer and follow the installation instructions.
  3. Verify the installation by running a simple Python script that imports pywin32:
import win32api
print(win32api.GetVersionEx())

Encountering the "Failed to run choco install pywin32 --yes" error can be a roadblock in your development process. However, by understanding the root cause and following the steps outlined above, you can overcome this issue and continue with your Electron project setup.

Related Post

AWS CodeCommit: The GitHub Large File Storage (Git LFS) Free Alternative

AWS CodeCommit offers a robust alternative to GitHub's Large File Storage (Git LFS) service, providing an efficient solution for managing large files in your Git repositories. Why You Should Reco

Read More

Quickly Convert Markdown to Academic-Style Paper PDF on macOS

In this guide, I'll walk you through how I convert Markdown documents to academic-style paper PDFs on macOS using Pandoc and BasicTeX. This method is quick and straightforward, perfect for when you n

Read More

Get current commit id of Git and update to package.json

When developing a Node.js project, you may want to keep track of the current commit ID of your Git repository. This information can be useful for debugging, versioning, or deployment purposes. One wa

Read More

Migrate a GitHub LFS (Git Large File Storage) repository to AWS CodeCommit

I recently migrated one of my GitHub repositories, which uses Git Large File Storage (LFS), over to AWS CodeCommit. I thought I'd share the process with you in case you’re looking to do something sim

Read More

Reset/Restore All subdirectories of Git

Managing a Git repository effectively often requires resetting or restoring subdirectories to maintain a clean and functional codebase. This guide provides a concise, step-by-step approach to reset o

Read More