Skip to content

Instantly share code, notes, and snippets.

@noonworks
Last active September 17, 2015 01:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save noonworks/28165444c4e5b040f55f to your computer and use it in GitHub Desktop.
(2015.09.17解決)今Windowsでelectron-prebuiltインストールしても動かんかもしれん

2015.09.17 追記

TL;DR

  • Windows 7 64bit で electron-prebuiltが正しくインストールできなくて動かない
  • extract-zipのバグっぽい
  • 手動でファイルコピーすればいけた

Workaround

  1. Electronのページからバイナリのzipをダウンロードしてきて解凍
  2. node_modules/electron-prebuilt/distlocalesresourcesのフォルダがないので、解凍したところからコピー

経緯

  • 30分で出来る、JavaScript (Electron) でデスクトップアプリを作って配布するまでをやろうと思った
  • electron .するもエラーで動かない
    C:\my_first_electron_app>electron .
    module.js:338
        throw err;
        ^
    
    Error: Cannot find module '%AppData%\npm\node_modules\electron-prebuilt\dist\resources\atom.asar\browser\lib\init.js'
        at Function.Module._resolveFilename (module.js:336:15)
        at Function.Module._load (module.js:286:25)
        at Function.Module.runMain (module.js:471:10)
        at startup (node.js:139:18)
        at node.js:991:3
    
  • %AppData%\npm\node_modules\electron-prebuilt\dist\resourcesフォルダがない
  • electron-prebuiltのインストールが正しくできていないのでは
  • インストールスクリプトを見るとElectron公式zipをダウンロードして解凍している
  • 公式zipを手動でダウンロードして解凍したものにはちゃんとresourcesフォルダがある
  • 「サブフォルダが解凍されていないのでは?」
  • 解凍にはextract-zipが使われているようだ
  • npm install extract-zip -gしてextract-zip [さっきダウンロードした公式zip]してみたらやっぱりサブフォルダがない
  • Issueあった
  • 手動でコピーしたらいけるやろか→いけた

2015/09/16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment