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 3 years have passed since last update.

Electronとelectron-builderのインストール時のエラー対処法

Last updated at Posted at 2020-11-13

1. electron が認識されない (パスは、すでに通してあります)

Terminal
$ which electron
$ electron -v
-bash: electron: command not found
$

( 1.の解決策 )

@masato_t さんの記事を参考に、次の手順を踏むことで、解決しました。

@masato_tさんのQiita記事「electronのインストールでコケた時の解決方法 on OS X」

Terminal
$ npm install -g n

( 省略 )

$ npm update -g npm

up to date in 521ms

found 0 vulnerabilities
$ rm -rf ~/.electron/
$ npm cache clear
( 省略 )
$ sudo npm install -g electron-prebuilt
Password:
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated electron-prebuilt@1.4.13: electron-prebuilt has been renamed to electron. For more details, see http://electron.atom.io/blog/2016/08/16/npm-install-electron
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 151 packages, and audited 151 packages in 22s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$

( 成功 ) 無事に、Terminal上で、electronが認識されました。

Terminal
$ electron -v
v1.4.13
$
$ which electron
/Users/AfoGuard/.nodebrew/current/bin/electron
$

2. electron-builder のインストール作業

以下の記事を参考に、npm i -D -g electron-builder を実行します。

@nanairo24さんのQiita記事「electron-builderでElectronアプリのビルド」

インストールの過程で、ディレクトリの作成権限がない、と出たため、_sudo を付けて実行_します。

Terminal
$ sudo npm i -D -g electron-builder
Password:

added 186 packages, and audited 186 packages in 11s

15 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$

インストール成功

Terminal
$ electron-builder
  • electron-builder  version=22.9.1 os=15.6.0
  • description is missed in the package.json  appPackageFile=/Users/Afoguard/Desktop/chrome_diver/electron_sample/package.json
  ⨯ Cannot compute electron version from installed node modules - none of the possible electron modules are installed.
See https://github.com/electron-userland/electron-builder/issues/3984#issuecomment-504968246
$

Terminal で、electron -v と打ち込むと、コマンドが認識されました。

Terminal
$ electron-builder -v
electron-builder build

Build

Building:
  -m, -o, --mac, --macos       Build for macOS, accepts target list (see
                               https://goo.gl/5uHuzj).                    [配列]
  -l, --linux                  Build for Linux, accepts target list (see
                               https://goo.gl/4vwQad)                     [配列]
  -w, --win, --windows         Build for Windows, accepts target list (see
                               https://goo.gl/jYsTEJ)                     [配列]
      --x64                    Build for x64                              [真偽]
      --ia32                   Build for ia32                             [真偽]
      --armv7l                 Build for armv7l                           [真偽]
      --arm64                  Build for arm64                            [真偽]
      --dir                    Build unpacked dir. Useful to test.        [真偽]
      --prepackaged, --pd      The path to prepackaged app (to pack in a
                               distributable format)
      --projectDir, --project  The path to project directory. Defaults to
                               current working directory.
  -c, --config                 The path to an electron-builder config. Defaults
                               to `electron-builder.yml` (or `json`, or
                               `json5`), see https://goo.gl/YFRJOM

Publishing:
  -p, --publish  Publish artifacts, see https://goo.gl/tSFycD
       [選択してください: "onTag", "onTagOrDraft", "always", "never", undefined]

Other:
      --help     ヘルプを表示                                             [真偽]
      --version  バージョンを表示                                         [真偽]

例:
  electron-builder -mwl                     build for macOS, Windows and Linux
  electron-builder --linux deb tar.xz       build deb and tar.xz for Linux
  electron-builder --win --ia32             build for Windows ia32
  electron-builder                          set package.json property `foo` to
  -c.extraMetadata.foo=bar                  `bar`
  electron-builder                          configure unicode options for NSIS

  --config.nsis.unicode=false

未知の引数です: v
$
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?