Why did not the node module installation


#1

hello,

I’m building my first app in electron and I’m stuck on a problem I can’t seem to fix.

I’m using Electron builder along with electron packager to export my .exe and .dmg. That all works fine but the none of my renderer node modules seem to work. The thing is : when i build my applications is puts them in the folder ‘/dist’, when i open the application over there it works. When I install it and it is stored in ‘My Applications’, the it doesn’t work.

Should I include the node_modules in my app folder ?

Can somebody spot what I’m doing wrong ?

My general folder structure :


#2

If you are using electron-packager, you do not need to make the app folder for electron. All files and directories you want included in your app should be in the directory you are running the electron-packager command from. Presumably, this is the top or root directory for you app. It’s also unusual (from what I’ve seen) that you have your package.json file in a directory. I’m sure there is a way to work around it, but the default action is to look for it in the root directory of your app.


#3

you need to bundle your node dependencies with your applications. When you are running from dev environment, your dependencies are found. When you package you app as .exe and .dmg, you need to use package.json field called bundleDependecies to put all native nodejs modules you are using.