electron-packager: How to include specific node_modules in dist?

490 views Asked by At

I'm very new to Electron and I have created this dumb demo app. It works fine if I run it with electron ., but when I build it with electron-packager, the dev tools tell me that it did not find several node_modules (like bootstrap, jquery), which I wanted to use.

How can I include bootstrap, jquery and electron-notifications (and their dependencies) in dist?

How do Electron users usually resolve this problem and how do they include specific node_modules?

Thanks in advance!

3

There are 3 answers

1
Adrian On

I think the easiest way is to reinstall the modules with

$ nmp install <package name> --save

Than you have the modules saved. And you don't have to change your code. You can also write after the --save --dev

0
Andrey Ponomarenko On

just use electron-builder. it works as expected right out of the box

0
Mike Cannon On

electron-packager will work with other node modules but I found my issue to be that I had the module I was using to be in both "dependencies" and "devDependencies" You need these modules to be in "dependencies" only and not in both. It will prune any modules listed in "devDependencies".