colinskow / angular-electron-dream-starter

:tada: An Angular Electron Starter kit featuring Webpack, Angular 4 (Router, Http, Forms, Services, ngrx, Tests, E2E, Coverage), Karma, Spectron, Jasmine, Istanbul, and TypeScript
MIT License
163 stars 54 forks source link

electron-builder structure change #31

Open Kaffiend opened 6 years ago

Kaffiend commented 6 years ago

^ on electron-builder package, on fresh installs is pulling in a version that has a different structure and breaks the install-app-deps helper.

bind-almir commented 6 years ago

I can confirm this issue in my case too.

Changing line number 3 inside config/install-app-deps.js from: const installOrRebuild = require('electron-builder/out/util/yarn').installOrRebuild; to: const installOrRebuild = require('electron-builder-lib/out/util/yarn').installOrRebuild;

resolved issue for me.

Kaffiend commented 6 years ago

so this happens when you install with npm, instead of yarn. Both should be supported. yarn does not install the electron-builder-lib package but npm does. Maybe we can change the build process to utilize the electron-builder install-app-deps command instead or we can simply put in a quick fix to handle which ever exists after install for the correct path in the script.

colinskow commented 6 years ago

Have you figured out why yarn behaves differently from npm?

d4hines commented 6 years ago

Thanks for the tip about using yarn instead of npm. As a quick fix it worked great.

arcanefoam commented 6 years ago

Till #32 fix is accepted, perhaps this?

try {   // Try with yarn layout
  installOrRebuild = require('electron-builder/out/util/yarn').installOrRebuild;
} catch (e) {
  if (e.code !== 'MODULE_NOT_FOUND') {
    throw e;
  }
  // Try with npm layout 
  installOrRebuild = require('electron-builder-lib/out/util/yarn').installOrRebuild;;   
}