Unable to load module that isn't specified in Electron app's package.json
See original GitHub issueI’m trying to package an electron app which resides in electron-app/
folder in my project folder. The modules are installed in ../node_modules
folder.
I have a module that is required in the preload script(electron-app/preload.js
) and attached to the window
object. After packaging this app, electron throws the said error with module not found
, but if I install the module in the electron-app
folder, everything works fine.
I’ve tried to push the ../node_modules
to module.paths
but to no avail.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Electron-packager: cannot find module - Stack Overflow
For me, I had to specify "main": "./dist/main.js" in package.json because it was trying to find index.js which is probably the default value....
Read more >package-lock.json - npm Docs
Description. package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json .
Read more >Creating an Electron application from scratch
An Electron application is an npm project with the electron package as a dependency. Our first steps will be creating the npm project...
Read more >Node Modules at War: Why CommonJS and ES ... - Code Red
Put the ESM wrapper in an esm subdirectory, alongside a one-line package.json file that says {"type": "module"} . (You could rename your wrapper ......
Read more >module not found error can't resolve 'fs' in electron - You.com
The error is because angular-CLI does not support modules in Nodejs like "fs" and "path". Add the following to the root of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
How would it know about those folders? You’ve specified that the app resides in
electron-app
, not its parent directory. Electron Packager doesn’t copy anything in the app’s parent directory.In order to debug your problem further, we need a minimal testcase to reproduce your problem. Using the
electron-quick-start
repository as a base, could you please create a minimal Electron app that illustrates the issue you described, and post a link to it here?