1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

electron-packagerをHTTPS Proxy環境下で

Posted at

https-proxy-agentを明示的に与えればいいのだけど、オプションが面倒なのでメモしておく。

https-proxy-agentのインストール

npm
npm install https-proxy-agent --save-dev
yarn
yarn add --dev https-proxy-agent

設定は.jsに外部化する。npm scriptの場合は例えばこんな感じ。

build.js
const packager = require('electron-packager');
const config = require('./package.json');
const HttpsProxyAgent = require('https-proxy-agent');

const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
if (httpsProxy) {
  const download = {
    downloadOptions: {
      agent: new HttpsProxyAgent(httpsProxy)
    }
  };
}

packager({
  ... 
  download: download,
  ...
}, function done (err, appPath) {
  if (err) {
    throw new Error(err);
  }
  console.log("Done: " + appPath);
});
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?