LoginSignup
42
49

More than 5 years have passed since last update.

ElectronアプリのWindowsインストーラを作成する

Last updated at Posted at 2015-09-21

ElectronでWindowsのインストーラを作るのがちょっとわかりづらいので、メモ

前提

  • Electronの開発、実行環境がある
  • gulpが使える

手順

まずはnpmで必要なパッケージを用意します。

npm install electron-packager --save
npm install electron-windows-installer --save

electron-packagerでパッケージを作っておきます。

(./publicの中にmain.jsがあるようなディレクトリ構成を想定しています。)

electron-packager ./public HelloApp --overwrite --platform=win32 --arch=x64 --version=0.31.2 --asar=true

installer実行のためにgulpfile.jsを書き換えます

gulpfile.js
var gulp = require("gulp");
var winInstaller = require('electron-windows-installer');
gulp.task('create_windows_installer', function(done) {
  winInstaller({
    appDirectory: './HelloApp-win32-x64',
    outputDirectory: './windows_installer',
    iconUrl: 'file://' + __dirname + + 'assets/icon.png'
  }).then(done).catch(done);
});

gulpを実行する

gulp create_windows_installer

これで、windows_installerフォルダの中にHelloAppSetup.exeが作成されます。

exeを実行するとユーザのAppData/Localの中にインストールされますが、Windows10だと新しいアプリとして検出してくれないです。(自分の環境だけ?)

このままだと、インストールされたのにどこに入ったのかたいていの人はわからないですね。

そのあたりの設定わかったら追記したいです。or知ってる人教えてください。

42
49
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
42
49