question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows Package Cannot find module 'electron'

See original GitHub issue

After building a package for windows via: electron-packager ./ <appName> --platform=win32 --arch=x64 --version=0.33.7

When I try to run the exe located inside the build folder I get an error saying cannot find module ‘electron’

image

my folder structure looks like this if it makes a difference…

image

and my main process code looks like https://gist.github.com/tylerbourque/54714e5c5120583d1d0f

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Deepakchawlacommented, Mar 23, 2017

Run this command npm install --save-dev electron For more detials https://www.christianengvall.se/electron-packager-tutorial/

0reactions
lysShubcommented, Sep 16, 2020

maybe you install electron global, in your project:

E:\OneDrive\code\electron\mydemo>electron-packager .
Cannot find module 'electron' from 'E:\OneDrive\code\electron\mydemo'

E:\OneDrive\code\electron\mydemo>npm install --save-dev electron
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
......

E:\OneDrive\code\electron\mydemo>electron-packager .
Downloading electron-v1.8.8-win32-x64.zip: [========================================-----------] 78% ETA: 58.2 seconds 
.......
Read more comments on GitHub >

github_iconTop Results From Across the Web

Electron-packager: cannot find module - Stack Overflow
Two things you can try: Make sure every node modules that you need to run on production build added into dependencies in package.json....
Read more >
electron-winstaller - npm
Module to generate Windows installers for Electron apps. Latest version: 5.1.0, last published: 2 months ago.
Read more >
Common Configuration - electron-builder
Defaults to true if electron-compile in the dependencies. And false if in the devDependencies or doesn't specified. electronDist String | module:app-builder- ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
The issue is that Node is unable to find the module that you are trying to import into your Node application. The most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found