electron / get

Download Electron release artifacts
https://npm.im/@electron/get
MIT License
338 stars 106 forks source link

GLOBAL_AGENT.HTTP_PROXY configuration value: URL protocol must be http: #215

Closed zzz08900 closed 2 years ago

zzz08900 commented 2 years ago

Preflight Checklist

Issue Details

Expected Behavior

Building Win32 packages from my Ubuntu machine (with Wine installed) using electron-packager . --platform=win32 --out=./builds Should get me Win32 artifacts in the ./builds folder.

Actual Behavior

Building Win32 packages from my Ubuntu machine (with Wine installed) using electron-packager . --platform=win32 --out=./builds results in error message: Unsupported GLOBAL_AGENT.HTTP_PROXY configuration value: URL protocol must be "http:". The error originated from global-agent which is an optional dependency of @electron/get.

To Reproduce

  1. find a Linux machine, create an empty nodeJS project, setup a barebone package.json
  2. put the following in package.json "devDependencies": { "electron": "^17.1.2", "electron-devtools-installer": "^3.2.0", "electron-packager": "^15.4.0" }
  3. try npx electron-packager . --platform=win32 --out=./builds, you shoule see the error message

Additional Information

Debug info attached below: electron-packager Electron Packager 15.4.0 electron-packager Node v14.17.5 electron-packager Host Operating system: linux 5.13.0-30-generic (x64) +0ms electron-packager Packager Options: {"_":["."],"platform":"win32","out":"./builds","deref-symlinks":true,"derefSymlinks":true,"download":{"rejectUnauthorized":true,"reject-unauthorized":true},"junk":true,"prune":true,"dir":".","protocols":[]} +2ms electron-packager Target Platforms: win32 +1ms electron-packager Target Architectures: x64 +0ms electron-packager Requiring author in package.json, as CompanyName was not specified for win32metadata +0ms electron-packager Inferring application name from name in {omitted}/package.json +13ms electron-packager Inferring appVersion from version in {omitted}/package.json +0ms electron-packager Inferring target Electron version from electron in {omitted}/package.json +5ms electron-packager Application name: {omitted} +18ms electron-packager Target Electron version: 17.1.2 +0ms electron-packager Ignored path regular expressions: [ '/package-lock\.json$', '/yarn\.lock$', '/\.git($|/)', '/node_modules/\.bin($|/)', '\.o(bj)?$', '/tmp/electron-packager' ] +0ms electron-packager Downloading Electron with options {"rejectUnauthorized":true,"reject-unauthorized":true,"platform":"win32","arch":"x64","version":"17.1.2","artifactName":"electron"} +0ms Unsupported GLOBAL_AGENT.HTTP_PROXY configuration value: URL protocol must be "http:".

malept commented 2 years ago

@zzz08900 What is the value of the HTTP_PROXY environment variable? Or, I guess, GLOBAL_AGENT.HTTP_PROXY?

This appears to be a regression from #214

CC: @BlackHole1

BlackHole1 commented 2 years ago

I found this: https://github.com/gajus/global-agent/blob/f82ad8a151af30f5bf218487d006771c6407bf89/src/utilities/parseProxyUrl.ts#L16

8EC2B6CE-B3FE-422A-A9D7-60564DA640CF

Please check the value of your proxy environment variables

alusnickic commented 2 years ago

For some reason, the following environment variables are set to undefined in the new release version 1.14.0 GLOBAL_AGENT_HTTP_PROXY, GLOBAL_AGENT_HTTPS_PROXY, GLOBAL_AGENT_NO_PROXY.

image

I've resolved this issue by downgrading the get package to the previous version 1.13.1.

I've resolved the dependency manually in my package.json file by adding "resolutions": { "@electron/get": "1.13.1" },

I've tried to unset those environment variables, but they are still present for some reason.

BlackHole1 commented 2 years ago

🤔 I will give reasons within 12 hours. It is the break si h in the Chinese time zone. 🙇‍♂️

BlackHole1 commented 2 years ago

Can you provide a repo url for the demo in order to be able to quickly pinpoint the problem?

BlackHole1 commented 2 years ago

I've found the problem, please wait. I will submit a PR later

electron-bot commented 2 years ago

:tada: This issue has been resolved in version 1.14.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

NixerSo5 commented 12 months ago

"electron": "^26.2.1" Operating System: Windows11 23545.1000 RequestError: Unsupported GLOBAL_AGENT.HTTP_PROXY configuration value: URL protocol must be "http:". it still not work and i don`t know how to fix it

BlacknoSheep commented 11 months ago

@NixerSo5 I encountered the same issue when installing the alpha version and the nightly version. It seems that only the stable version has fixed this bug. My solution is:

$env:ELECTRON_GET_USE_PROXY=1
$env:GLOBAL_AGENT_HTTP_PROXY="http://127.0.0.1:7890"
# Don't chang GLOBAL_AGENT_HTTPS_PROXY

However, it still took me 40 minutes to install electron@v28.0.0-alpha.2. (While installing the stable version only took me a few seconds.

siluo2000 commented 9 months ago

Here's my solution, maybe it will work for you guys: https://cloud.tencent.com/developer/article/2369773