aurelia-cli-electron-app icon indicating copy to clipboard operation
aurelia-cli-electron-app copied to clipboard

Error in distribution: Cannot find module 'electron-reload'

Open mcpride opened this issue 7 years ago • 3 comments

At first: currently i try to learn building electron apps by example. Thank you for your work, it's a great help. The configuration of this project is excellent - debugging and packaging for distribution works fine.

But if I call the distributed electron app on my WIN10 x64 machine then following error occurs:

Uncaught Exception:
Error: Cannot find module 'electron-reload'
    at Module._resolveFilename (module.js:470:15)
    at Function.Module._resolveFilename (C:\Tests\Aurelia\aurelia-cli-electron-app\dist\win-unpacked\resources\electron.asar\common\reset-search-paths.js:35:12)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Tests\Aurelia\aurelia-cli-electron-app\dist\win-unpacked\resources\app.asar\index.js:5:1)
    at Object.<anonymous> (C:\Tests\Aurelia\aurelia-cli-electron-app\dist\win-unpacked\resources\app.asar\index.js:31:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)

I'm a beginner in this field - so I have no idea how to fix this. Could you help me, please?

mcpride avatar Mar 21 '17 11:03 mcpride

I'd not actually had a chance to use the dist yet (it was PR'ed by a contributor).

I guess you could remove this line: https://github.com/MeirionHughes/aurelia-cli-electron-app/blob/master/index.js#L5

its only supposed to be there during development so it auto-reloads for you when you change source files.

MeirionHughes avatar Mar 21 '17 11:03 MeirionHughes

Thanx for your hint, commenting out the related require entry in index.js works but then the auto-reload function is disabled.

mcpride avatar Mar 21 '17 19:03 mcpride

you should check if dev mode: if (process.env.NODE_ENV === 'development') { require('electron-reload')(__dirname) }

ChauVV avatar Dec 04 '17 09:12 ChauVV