GithubHelp home page GithubHelp logo

electron / get Goto Github PK

View Code? Open in Web Editor NEW
334.0 22.0 106.0 43.67 MB

Download Electron release artifacts

Home Page: https://npm.im/@electron/get

License: MIT License

JavaScript 0.30% TypeScript 99.70%
electron

get's Introduction

@electron/get

Download Electron release artifacts

CircleCI NPM package

Usage

For full API details, see the API documentation.

Simple: Downloading an Electron Binary ZIP

import { download } from '@electron/get';

// NB: Use this syntax within an async function, Node does not have support for
//     top-level await as of Node 12.
const zipFilePath = await download('4.0.4');

Advanced: Downloading a macOS Electron Symbol File

import { downloadArtifact } from '@electron/get';

// NB: Use this syntax within an async function, Node does not have support for
//     top-level await as of Node 12.
const zipFilePath = await downloadArtifact({
  version: '4.0.4',
  platform: 'darwin',
  artifactName: 'electron',
  artifactSuffix: 'symbols',
  arch: 'x64',
});

Specifying a mirror

To specify another location to download Electron assets from, the following options are available:

  • mirrorOptions Object
    • mirror String (optional) - The base URL of the mirror to download from.
    • nightlyMirror String (optional) - The Electron nightly-specific mirror URL.
    • customDir String (optional) - The name of the directory to download from, often scoped by version number.
    • customFilename String (optional) - The name of the asset to download.
    • resolveAssetURL Function (optional) - A function allowing customization of the url used to download the asset.

Anatomy of a download URL, in terms of mirrorOptions:

https://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip
|                                                     |       |                           |
-------------------------------------------------------       -----------------------------
                        |                                                   |
              mirror / nightlyMirror                  |    |         customFilename
                                                       ------
                                                         ||
                                                      customDir

Example:

import { download } from '@electron/get';

const zipFilePath = await download('4.0.4', {
  mirrorOptions: {
    mirror: 'https://mirror.example.com/electron/',
    customDir: 'custom',
    customFilename: 'unofficial-electron-linux.zip'
  }
});
// Will download from https://mirror.example.com/electron/custom/unofficial-electron-linux.zip

const nightlyZipFilePath = await download('8.0.0-nightly.20190901', {
  mirrorOptions: {
    nightlyMirror: 'https://nightly.example.com/',
    customDir: 'nightlies',
    customFilename: 'nightly-linux.zip'
  }
});
// Will download from https://nightly.example.com/nightlies/nightly-linux.zip

customDir can have the placeholder {{ version }}, which will be replaced by the version specified (without the leading v). For example:

const zipFilePath = await download('4.0.4', {
  mirrorOptions: {
    mirror: 'https://mirror.example.com/electron/',
    customDir: 'version-{{ version }}',
    platform: 'linux',
    arch: 'x64'
  }
});
// Will download from https://mirror.example.com/electron/version-4.0.4/electron-v4.0.4-linux-x64.zip

Using environment variables for mirror options

Mirror options can also be specified via the following environment variables:

  • ELECTRON_CUSTOM_DIR - Specifies the custom directory to download from.
  • ELECTRON_CUSTOM_FILENAME - Specifies the custom file name to download.
  • ELECTRON_MIRROR - Specifies the URL of the server to download from if the version is not a nightly version.
  • ELECTRON_NIGHTLY_MIRROR - Specifies the URL of the server to download from if the version is a nightly version.

Overriding the version downloaded

The version downloaded can be overriden by setting the ELECTRON_CUSTOM_VERSION environment variable. Setting this environment variable will override the version passed in to download or downloadArtifact.

How It Works

This module downloads Electron to a known place on your system and caches it so that future requests for that asset can be returned instantly. The cache locations are:

  • Linux: $XDG_CACHE_HOME or ~/.cache/electron/
  • MacOS: ~/Library/Caches/electron/
  • Windows: %LOCALAPPDATA%/electron/Cache or ~/AppData/Local/electron/Cache/

By default, the module uses got as the downloader. As a result, you can use the same options via downloadOptions.

Progress Bar

By default, a progress bar is shown when downloading an artifact for more than 30 seconds. To disable, set the ELECTRON_GET_NO_PROGRESS environment variable to any non-empty value, or set quiet to true in downloadOptions. If you need to monitor progress yourself via the API, set getProgressCallback in downloadOptions, which has the same function signature as got's downloadProgress event callback.

Proxies

Downstream packages should utilize the initializeProxy function to add HTTP(S) proxy support. If the environment variable ELECTRON_GET_USE_PROXY is set, it is called automatically.

Debug

debug is used to display logs and messages. Set the DEBUG=@electron/get* environment variable to log additional debug information from this module.

get's People

Contributors

alexeykuzmin avatar benlancaster avatar blackhole1 avatar ckerr avatar clavin avatar codebytere avatar ddramone avatar dependabot[bot] avatar develar avatar dsanders11 avatar electron-roller[bot] avatar erickzhao avatar felixrieseberg avatar ffflorian avatar fritx avatar joaomoreno avatar kevinsawicki avatar lele85 avatar mafintosh avatar makotot avatar malept avatar marshallofsound avatar max-mapper avatar muzuiget avatar obaratch avatar omrilitov avatar popomore avatar quicksnap avatar siilwyn avatar tehbilly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

get's Issues

Regression: taobao mirror does not have v in directory path

when i use mirror site
it seems that @electron/get request the wrong url:
https://npm.taobao.org/mirrors/electron/v7.0.0/electron-v7.0.0-darwin-x64.zip
in 6.1.2
https://npm.taobao.org/mirrors/electron/6.1.2/electron-v6.1.2-darwin-x64.zip
it not strip 'v' from version number in the dir part .

so different behavior for electron-download from @electron/get package

The specific information is here

Cache Corruption

Continuation from : electron-userland/electron-prebuilt#25

The problem is assuming the download completes, here:

20   if (pathExists.sync(cachedZip)) {
21      return cb(null, cachedZip)
22    } 

If the download doesn't complete, then the cache is corrupted. the solution suggested by @mafintosh was creating a tmp directory initially, but this is the repo to make that PR now

Verify checksums of Electron zip files

Checksums should be provided by the Electron project. The verification process looks like this:

  1. Download and parse the checksum file(s). If a 404 is encountered, skip steps 3 & 4
  2. Download the zip
  3. Generate a checksum against the downloaded zip
  4. If the checksums do not match, throw an exception

Blocked on electron/electron#6588

Environment variable usage is not documented

While skimming the source code, I noticed that the mirror URL can also be constructed from environment variables, and not just an options object. What's more, the environment variables take preference over the options object. Not sure if it was intended to leave this little detail out.

Unless that's intended, documentation for this package isn't that great. I'd love to see this improved.

http proxy options don't work on mac

Version: [email protected]

Further to electron-userland/electron-prebuilt#21 the standard http_proxy environment variables work fine on windows and linux, but they don't seem to work on Mac.

On Mac it doesn't work, but I can download the file manually using curl proving the proxy is working:

$ uname
Darwin
$ export HTTP_PROXY=http://fwdproxy:8080
$ export HTTPS_PROXY=http://fwdproxy:8080
$ ./node_modules/.bin/electron-download --version=1.7.9
Downloading tmp-65425-0-electron-v1.7.9-darwin-x64.zip
Error: tunneling socket could not be established, cause=connect ENETUNREACH 10.238.0.14:8080 - Local (0.0.0.0:57223)
/data/sandcastle/boxes/trunk-hg-fbobjc-fbsource/fbobjc/Apps/workplace-desktop/node_modules/electron-download-tf/lib/cli.js:15
  if (err) throw err
           ^

Error: tunneling socket could not be established, cause=connect ENETUNREACH 10.238.0.14:8080 - Local (0.0.0.0:57223)
    at ClientRequest.onError (/data/sandcastle/boxes/trunk-hg-fbobjc-fbsource/fbobjc/Apps/workplace-desktop/node_modules/tunnel-agent/index.js:177:17)
    at ClientRequest.g (events.js:260:16)
    at emitOne (events.js:77:13)
    at ClientRequest.emit (events.js:169:7)
    at Socket.socketErrorListener (_http_client.js:265:9)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1253:8)
    at doNTCallback2 (node.js:450:9)
    at process._tickCallback (node.js:364:17)
$ curl -L -p -x http://fwdproxy:8080 --create-dirs -o $HOME/Library/Caches/electron/electron-v1.7.9-darwin-x64.zip https://github.com/electron/electron/releases/download/v1.7.9/electron-v1.7.9-darwin-x64.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   619    0   619    0     0   1479      0 --:--:-- --:--:-- --:--:--  1480
100 46.1M  100 46.1M    0     0  18.5M      0  0:00:02  0:00:02 --:--:-- 25.0M

On Linux in the same environment it works fine:

$ uname
Linux
$ export HTTP_PROXY=http://fwdproxy:8080
$ export HTTPS_PROXY=http://fwdproxy:8080
$ ./node_modules/.bin/electron-download --version=1.7.9
Downloading tmp-998848-0-electron-v1.7.9-linux-x64.zip
[============================================>] 100.0% of 51.24 MB (13.66 MB/s)
Downloaded zip: /home/ianj/.cache/electron/electron-v1.7.9-linux-x64.zip

The link to download the zip is wrong

env: MacOS
I just set electron_mirror=https://npm.taobao.org/mirrors/electron/ in ~/.npmrc,
I executed npm i electron --save in my project,
and I got an error

(node:12375) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found) for https://npm.taobao.org/mirrors/electron/v8.0.2/electron-v8.0.2-darwin-x64.zip
    at EventEmitter.emitter.on.response (/Users/maxiaojin/project/electron-test/node_modules/got/source/as-stream.js:35:24)
    at EventEmitter.emit (events.js:198:13)
    at module.exports (/Users/maxiaojin/project/electron-test/node_modules/got/source/get-response.js:22:10)
    at ClientRequest.handleResponse (/Users/maxiaojin/project/electron-test/node_modules/got/source/request-as-event-emitter.js:155:5)
    at Object.onceWrapper (events.js:286:20)
    at ClientRequest.emit (events.js:203:15)
    at ClientRequest.origin.emit.args [as emit] (/Users/maxiaojin/project/electron-test/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:556:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
    at TLSSocket.socketOnData (_http_client.js:442:20)
(node:12375) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12375) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I make it work by change the source code at node_modules/@electron/get/dist/cjs/artifact-util.js: 33 getArtifactRemoteURL like this:

function getArtifactRemoteURL(details) {
    const opts = details.mirrorOptions || {};
    let base = mirrorVar('mirror', opts, BASE_URL);
    if (details.version.includes('nightly')) {
        base = mirrorVar('nightly_mirror', opts, NIGHTLY_BASE_URL);
    }
    const path = mirrorVar('customDir', opts, details.version).replace('{{ version }}', details.version.replace(/^v/, ''));
    path = path.replace('v', '');
    const file = mirrorVar('customFilename', opts, getArtifactFileName(details));
    return `${base}${path}/${file}`;
}

This is a bad way, please fix it!

Clear or ignore cache

It'd be really helpful if I could either clear the cache via the CLI, or instruct electron-download to ignore cache during install via the API & CLI.

I have a workflow for a project, which involves republishing custom electron binaries without changing the name or version. I know, it's a little bit like this xkcd, but it saves me some headache if I can republish and just clear the cache automatically. (It lets me avoid making lots of commits that change a version number during development.)

A command which clears the cache, or a way to instruct the downloader to overwrite the cache, would be fine. Happy to make a PR based on your preference.

What license should I mention this repository under

I am build an electron app and this repository is transitive dependency of my project.

ISSUE:

There is no license attached to this repository and nothing mentioned in readme document.

SOLUTION:

can you add or guide me about license formalities of this repository

Re-add progress bar by default

I'm having significant issues with electron's postinstall script. For some reason, I am getting extremely low (~1 kbps) from GitHub Releases. I don't know if it's on my end or GitHub's, everything else is working fine for me.

  1. According to electron/electron-quick-start#127 , doing npm install --verbose [email protected] should log the download progress, but no such thing is happening.

  2. After figuring out why the script was hanging, https://medium.com/@muellermarkus/download-electron-releases-from-a-faster-mirror-than-github-741bac15c3c9 pointed me to https://www.npmjs.com/package/electron-download

  3. electron-download's homepage redirects to here, but I'm not seeing any reference to a CLI.

  4. electron-download works, but it caches the files without the sanitized url in the file path, while @electron/get does, which means, it's not finding the files I downloaded manually.

If electron-download is deprecated, the NPM package should be marked as such.

The download should log progress by default, that's how https://github.com/GoogleChrome/puppeteer does it for Chromium; hanging on node install.js for 30min with 0 feedback is terrible UX.

nugget does not consider npm/yarn cafile property

Hello together,

your dependency nugget does not consider the npm/yarn config property cafile which is used in case you are using a self signed certificate chain. This issue is the reason why we have to set strict-ssl=false. Other packages like node-gyp or node-pre-gyp are using request instead of nugget which handles the cafile property correctly.

The nugget team received a PR (max-mapper/nugget#11) in 2015. Sadly there are no updates in the PR since then. They know about that issue and don't solve it.

Since there are some proposals around to either replace nugget (#53) or to use got (#63) I want to know how you will go on with the nugget topic.

Thank you,
Stefan

Save cached releases to standard directories

Instead of placing the release archives in the home directory they should be placed in the appropriate directory per OS. I've done the same for Greenkeeper's RC so I'd like to create a PR for it.

Before doing that I'd like to know if there are any special things I should take into consideration and if the core contributors are on board with this so I don't do it in vain. :)

Electron version-based regressions

While trying to get Electron Packager switched over to use @electron/get instead of electron-download, I found some regressions related to Electron versions:

  • chromedriver special case for Electron < 1.7.0:

    get/lib/index.js

    Lines 102 to 107 in 29708b9

    // Chromedriver started using Electron's version in asset name in 1.7.0
    if (semver.gte(this.version, '1.7.0')) {
    return `chromedriver-${suffix}.zip`
    } else {
    return `chromedriver-v2.21-${type}.zip`
    }
  • Checksums started getting generated in Electron 1.3.2:
    return !this.opts.disableChecksumSafetyCheck && semver.gte(this.version, '1.3.2')

The second bullet point is causing Electron Packager tests to fail.

I suppose the question becomes, what Electron versions should tools support? (Which inevitably becomes a topic for the Docs & Tools WG...) Electron Packager tries to support as many Electron versions as possible; there are still some conditionals for the super-ancient 0.37.x series.

Windows Error: "EPERM: operation not permitted, lstat"

Dear All,

We are trying to package our electron application for win32 platform .

Steps that we have already followed:

  1. Using electron-packager we tried to build the .exe file of our application but we ran into the lstat error.

so I have logged the issue under electron-packager
electron/packager#1064

Form there I was advised to download the binary files using electron/get
2) We downloaded the electron/get module and tried running the simple js file to download binary files
but facing the same issue :
Error: EPERM: operation not permitted, lstat 'C:\Users\arun\AppData\Local\Temp\electron-download-nY2x6M\electron-v6.0.7-win32-x64.zip'

Even after setting cache folder as electon_cache=C:\Users\ath6cob\AppData\Local\electron\Cache in environment variable the download creates random temp folder whenever i run the command.

I am a beginner but it is really becoming difficult to build an exe file.

Please advise

`Arun

Please depreciate 1.0.0

IMO everything before this commit 1ac4d11 should be depcreciated on npm and maybe upgrade semver major/minor so nobody accidently uses it

os.tmpdir()

iojs breaking changes

Provides consistency across platforms, no call to os.tmpdir() returns a trailing slash.

maybe versions of node are weird with tmpdir()? I'm closing this issue as soon as I make it because IMO it's not worth changing - but I'm just curious why it's acting weird with (some people) - never had an issue.

Switch to promise based API

Will be a major bump, maybe we can make this backwards compatible (I.e. support cb syntax as well as a promise based syntax)

GitHub download ratios

Short question, due the fact that electron-download is pulling releases from https://github.com/electron/electron/releases/download/v do the request may run into request limits?

Background of the question is that I'm frequently using electron-packager for workshops. When multiple attendees use the same IP address to download the releases, github may restrict access for an hour.

Unfortunately there is no option or provide an API token. (gulp-atom-electron allows to specify an API_Token for example)

Did anyone run into this issue?

The 'cache' option is ignored when retrieving SHASUM file

The cache options let's me specify a location on my local machine where electron-download will find an existing Electron package it should use instead of downloading it from somewhere. This works just fine.

However, this option is ignored when electron-download starts looking for the SHASUM file. Either the package should use the same cache location, or another option should be added.

Set up Windows CI

We seem to have lost AppVeyor/Windows CI in the move to the electron org. That would have been particularly helpful for #95. Can this repo be set up in the electron org's Windows CI config?

back port sumchecker 2.0.2 to 3.x

Hello could you backport sumcheck upgrade to 3.x version?
On node 8 it not possible to download electron as I am getting:
Error: Generated checksum for "chromedriver-v2.21-win32-x64.zip" did not match expected checksum.

In sumchecker 2 it was fixed malept/sumchecker#7

I see that:

but since electron has reverted the update to electron-download 4 for a reason (electron/electron@6f3fdb6) I am asking here ๐Ÿ™‚

How do you fetch the download links?

Hello,

Could you, please, tell me how do you (if you do) fetch the list of versions, used to download the binaries?

Edit: I just found this in index.js ... my question is what would happen if the given version is non-existent (as in: a random version)?

 var filename = 'electron-v' + version + '-' + platform + '-' + arch + (symbols ? '-symbols' : '') + '.zip'
   var url = process.env.ELECTRON_MIRROR || opts.mirror || 'https://github.com/atom/electron/releases/download/v'
   url += version + '/electron-v' + version + '-' + platform + '-' + arch + (symbols ? '-symbols' : '') + '.zip'

can't download electron on arm64 Debian

Can't download electron on arm64 Debian

lsb_release

Distributor ID:	Debian
Description:	Debian GNU/Linux 8.8 (jessie)
Release:	8.8
Codename:	jessie

uname -a

Linux 3.10.65 #71 SMP PREEMPT Mon Jun 19 17:19:58 CST 2017 aarch64 GNU/Linux

the install.js throw a ENOTFOUND exception.
but when I use command 'getent hosts', It works fine.
image

The `mirror` options don't work for URL endpoints requiring credentials

The mirror, customDir, and customFilename options let you specify a custom URL and path to download Electron packages from. For publicly available resources, this works fine.

This is insufficient for secure resources. For example, I can't download anything from a URL that requires authentication via a SAS token.

Techincally, I can use a SAS token by appending a query string to customFilename. This doesn't work, however, when attempting to download SHASUM files.

See #71 for a related issue.

Global binary is missing

I used electron-download a lot, but now when I use this utility to download electron to local cache, I always failed with the error shown on #122. I go through the code, find the cache location changed from %LOCALAPPDATA%/electron/Cache to %LOCALAPPDATA%/electron/Cache/httpnpm.taobao.orgmirrorselectronv8.0.0electron-v8.0.0-win32-x64.zip. For this change, I could not use electron-download to download electron from mirror especially from China, and install electron via the local cache from electron-download.
I found the repository changed from https://github.com/electron-userland/electron-download to https://github.com/electron/get.
Can we provide a binary for downloading electron to local cache like .electron-download did?

Add debug support

To make it easier to handle support questions and also to assist in debugging issues.

cannot install

npm i electron
> [email protected] postinstall /Users/willin/Documents/js.cool/hosts.js/node_modules/electron
> node install.js

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@


^@^@^@^@^@^@^@^@^@^@^@^C

never success

Use `electron_config_cache` env var to search for cached downloads

Electron docs say that one can override path to cached electron downloads via the electron_config_cache environment variable, but it doesn't seem to be the case with electron-get - the env var is ignored and, as far as I understand, cache path is unconditionally resolved to something like $XDG_CACHE_HOME/electron/sanitazed_url/electron.zip:

get/src/Cache.ts

Lines 17 to 22 in f2c6253

public getCachePath(downloadUrl: string, fileName: string): string {
const { search, hash, ...rest } = url.parse(downloadUrl);
const strippedUrl = url.format(rest);
const sanitizedUrl = sanitize(strippedUrl);
return path.resolve(this.cacheRoot, sanitizedUrl, fileName);

electron-downoad did respect electron_config_cache.

Error: Configuration is invalid.

Using cache option instead of downloading the electron package and getting this error below.

electrondownload

Not able to find the option version from the link mentioned above.

These are the properties used in package.json
"electronDownload": { "cache": "./conf/electron", "verifyChecksum": false }

disable checksum

Could it be possible to disable checksum when we tell electron-download to download electron from a private location? I'm creating a PR to detail this change

Unable to get mirrorOptions to work

This surfaced for me via when trying to build multiple targets (ie ia32/x64) via electron-packager on Windows (elsewhere I expect an already pre-filled cache avoided the problem). It's the same when isolated to @electron/get and I think mirrorOptions are getting ignored (or I've misconfigured somehow).

Version wise I'm using :

> npm list @electron/get
[email protected] /Users/simon/code/ipd
โ””โ”€โ”ฌ [email protected]
  โ””โ”€โ”€ @electron/[email protected]

To reproduce you can use:

process.env.DEBUG='*';
const { download } = require('@electron/get');

async function dl() {
    const zipFilePath = await download('6.0.5-wvvmp', {
         mirrorOptions: {
            baseUrl: 'https://github.com/castlabs/electron-releases/releases/download/v'
        },
        cacheRoot: './.electron-dl-cache'
    });

    console.log('Download to:', zipFilePath);
}

dl();

or

process.env.DEBUG='*';
const {  downloadArtifact } = require('@electron/get');

async function art() {
    const zipFilePath = await downloadArtifact({
        version: '6.0.5-wvvmp',
        artifactName: 'electron',
        mirrorOptions: {
            baseUrl: 'https://github.com/castlabs/electron-releases/releases/download/v'
        },
        cacheRoot: './.electron-dl-cache'
    });

    console.log('Download artifact to:', zipFilePath);
}

art()

and you should see a Mac failure along the lines of

> node download-electron-test.js
  @electron/get:index Checking the cache for electron-v6.0.5-wvvmp-darwin-x64.zip +0ms
  @electron/get:index Cache miss +2ms
  @electron/get:index Downloading https://github.com/electron/electron/releases/download/v6.0.5-wvvmp/electron-v6.0.5-wvvmp-darwin-x64.zip to /var/folders/w1/5zxtsx7j0t5406kqx9hc7h7w0000gn/T/electron-download-0FvTbq/electron-v6.0.5-wvvmp-darwin-x64.zip with options: undefined +44ms
(node:87942) UnhandledPromiseRejectionWarning: HTTPError: Response code 404 (Not Found)
    at EventEmitter.<anonymous> (/Users/simon/code/ipd/node_modules/got/source/as-stream.js:35:24)
    at EventEmitter.emit (events.js:200:13)
    at module.exports (/Users/simon/code/ipd/node_modules/got/source/get-response.js:22:10)
    at ClientRequest.handleResponse (/Users/simon/code/ipd/node_modules/got/source/request-as-event-emitter.js:155:5)
    at Object.onceWrapper (events.js:288:20)
    at ClientRequest.emit (events.js:205:15)
    at ClientRequest.origin.emit (/Users/simon/code/ipd/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:23)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:17)
    at TLSSocket.socketOnData (_http_client.js:452:22)

or get led in the wrong direction by Windows suggesting it's a local file system problem:

PS C:\Users\simongregory\code\ipd> node .\download-test.js
  @electron/get:index Checking the cache for electron-v6.0.5-wvvmp-win32-x64.zip +0ms
  @electron/get:index Cache miss +6ms
  @electron/get:index Downloading https://github.com/electron/electron/releases/download/v6.0.5-wvvmp/electron-v6.0.5-wvvmp-win32-x64.zip to C:\Users\SIMONG~1\AppData\Local\Temp\electron-download-1raX2i\electron-v6.0.5-wvvmp-win32-x64.zip with options: undefined +57ms
(node:1980) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, lstat 'C:\Users\SIMONG~1\AppData\Local\Temp\electron-download-1raX2i\electron-v6.0.5-wvvmp-win32-x64.zip'
(node:1980) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1980) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

But both show that the remote endpoint isn't getting changed to honour the mirror settings.

bug: the SHASUMS256.txt download ignores mirrorOptions

When a mirror is used a "SHASUMS256.txt" files still gets downloaded from https://github.com/electron/electron/releases/download/VERSION/SHASUMS256.txt

get/src/index.ts

Lines 103 to 110 in 9acfe87

const shasumPath = await downloadArtifact({
isGeneric: true,
version: artifactDetails.version,
artifactName: 'SHASUMS256.txt',
force: artifactDetails.force,
downloadOptions: artifactDetails.downloadOptions,
downloader: artifactDetails.downloader,
});

bug: the "artifactSuffix" option is ignored

Running an example from the README downloads an Electron archive instead of symbols
because the artifactSuffix: 'symbols', option doesn't do anything.

const zipFilePath = await downloadArtifact({
  version: '4.0.4',
  platform: 'darwin',
  artifactName: 'electron',
  artifactSuffix: 'symbols',
  arch: 'x64',
});

return `${[details.artifactName, details.version, details.platform, details.arch].join('-')}.zip`;

Permission Denied when Deploying on AWS and creating the temporary directory

Hello,

I am trying to run NightmareJS on Elastic Beanstalk and I keep having an issue with Electron.

Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/electron/electron-tmp-download-2233-1478789913678'

Here are the full logs: https://gist.github.com/QuentinDela/49e824c5889e14e899eafbe850d23055

Here is the related issue on nightmare:
electron/electron#7938

Would you have any ideas on how to fix this?

Thanks,

Conversion to ES6 should have resulted in a major version change

Due to ES6 conversion, this module no longer works in Node.js environments < 4. As a result, while electron is perfectly usable in earlier environments, downloading electron no longer works. This is causing builds to fail during the npm install process.

The workaround here, in order to support earlier environments, would be to either a) revert back to ES5 or b) use babel or some other transpiler to transpile the ES6 code to ES5 pre-publish.

@electron/get suppresses 404 error

After the issues in #124 I abandoned electron-download in favor of setting ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/" as described in https://electronjs.org/docs/tutorial/installation#custom-mirrors-and-caches.

After figuring out to also set DEBUG=*, I got the following log...

2019-11-02T20:26:37.230Z @electron/get:index Checking the cache for electron-v7.0.0-win32-x64.zip (https://npm.taobao.org/mirrors/electron/v7.0.0/electron-v7.0.0-win32-x64.zip)
2019-11-02T20:26:47.144Z @electron/get:index Cache miss
2019-11-02T20:26:47.221Z @electron/get:index Downloading https://npm.taobao.org/mirrors/electron/v7.0.0/electron-v7.0.0-win32-x64.zip to C:\Users\aval\AppData\Local\Temp\electron-download-DId6EI\electron-v7.0.0-win32-x64.zip with options: undefined
(node:8096) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, lstat 'C:\Users\aval\AppData\Local\Temp\electron-download-DId6EI\electron-v7.0.0-win32-x64.zip'
warning.js:27
(node:8096) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
warning.js:27
(node:8096) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
warning.js:27

It took setting a breakpoint on all exceptions, to figure out the underlying issue has nothing to do with permissions, but that the constructed URL is invalid, because https://npm.taobao.org/mirrors/electron/ doesn't include vs in front of the version! This leads to a HTTP 404, but it isn't logged anywhere.

The docs should be improved and something done so that mirrors URLs can be used interchangeably, but in any case, electron/get needs to log HTTP errors.

Throw error when cached Electron isn't found instead of downloading by default

I use a private build of Electron that I store on my local machine, and I use electron-packager to package my application. To use my private Electron, I set the cache option.

Debugging my build scripts was very cumbersome, because electron-download gave no indication of whether it could find the Electron build in the cache location or not. If it can't find Electron, it defaults to downloading public releases.

This is not what I want! I don't want the publicly available bits. I'd rather electron-download throw an error that I can catch and act on quickly.

electron/packager#187

Malware in Win32 ia32 v1.1.0 download?

Downloading electron using:

electron-download --version=1.1.0 --platform=win32 --arch=ia32

The zip file contains libGLESv2.dll which appears to contain the Pennybee malware, as detected by Webroot.

Testing against v1.2.0 seems to be clean

please follow redirect

Hi, I'd like to download electron from a location on our corporate sonatype nexus.
The uri returned by nexus gives a redirect (302). Redirect is not followed. package is therefore not downloaded even if it exists.

I get the following error:

npm i [email protected] --save-dev --reg
http://internalrepository.addr.corp:8081/nexus/content/groups/build.milestones.npm/                           
(node:11289) fs: re-evaluating native module sources is not supported.
If you are using the graceful-fs module, please update it to a more
recent version.

> [email protected] postinstall /home/me/wing/node_modules/electron
> node install.js

/home/me/wing/node_modules/electron/install.js:46
  throw err
  ^

Error: Failed to find Electron v1.4.15 for linux-x64 at
http://internalrepository.addr.corp:8081/nexus/service/local/repositories/3rd-party.releases.manual-uploads.hosted/content/io/atom/electron/download/electron/electron/1.4.15/electron-1.4.15-linux-x64.zip
    at Request.<anonymous>
(/home/I301937/wing/node_modules/nugget/index.js:169:61)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at Request.onRequestResponse
(/home/I301937/wing/node_modules/request/request.js:1074:10)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming]
(_http_client.js:474:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
    at Socket.socketOnData (_http_client.js:363:20)
    at emitOne (events.js:96:13)

However http://internalrepository.addr.corp:8081/nexus/service/local/repositories/3rd-party.releases.manual-uploads.hosted/content/io/atom/electron/download/electron/electron/1.4.15/electron-1.4.15-linux-x64.zip does exist.

FYI: I use the following env variables to specify a different electron uri:
ELECTRON_CUSTOM_FILENAME="electron-1.4.15-linux-x64.zip"
ELECTRON_MIRROR="http://internalrepository.addr.corp:8081/nexus/service/local/repositories/3rd-party.releases.manual-uploads.hosted/content/io/atom/electron/download/electron/electron/1.4.15"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.