To fix the issue that I don’t currently have the exactly error string was a headache, but I fixed finally.
If you debug Electron gulp build process, you will end up knowing that the issue comes with the require(‘appdmg’) line of code in the build. Easy, go to node_modules folder, find the appdmg go inside and execute npm install. It’ll install node_modules inside that folder which will solve the issue just in your local, but it works.
My issue was on a Mac running under El Capitan.
Hope this helps me the next time, or maybe you!