JavaScript error running Windows packaged app
See original GitHub issueBuild and Target platform: Windows 7 64bit
Running the generated Exe results in an error dialog being presented reporting
"A JavaScript error occurred in the main process". "Uncaught Exception: TypeError: Cannot read property 'require' of undefined at Object.<anonymous>"
Console output during build
> electron1@1.0.0 build C:\Users\gilmore_tj\Documents\NodeJS\Electron1
> electron-packager . Electron1 --ignore=node_modules/electron-*
Error output during build
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Electron Packager 8.0.0
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Node v6.3.1
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Host Operating system: win32 (x64)
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Packager Options: {"_":[".","Electron1"],"all":false,"deref-symlinks":true,"download":{"strictSSL":true},"overwrite":false,"prune":true,"ignore":"node_modules/electron-*","dir":".","name":"Electron1","protocols":[]}
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Target Platforms: win32
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Target Architectures: x64
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Inferring app-version from version in package.json
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Inferring target Electron version from electron-prebuilt dependency or devDependency in package.json
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Application name: Electron1
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Target Electron version: 1.4.0
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Ignored path regular expressions: [ 'node_modules/electron-*',
'/node_modules/electron($|/)',
'/node_modules/electron-prebuilt($|/)',
'/node_modules/electron-packager($|/)',
'/\\.git($|/)',
'/node_modules/\\.bin($|/)' ]
Fri, 16 Sep 2016 07:35:18 GMT electron-packager Downloading Electron with options {"strictSSL":true,"platform":"win32","arch":"x64","version":"1.4.0"}
Skipping win32 x64 (output dir already exists, use --overwrite to force)
Package.json command
electron-packager . Electron1 --ignore=node_modules/electron-*
Code provided at https://github.com/TracyGJG/ElectronWindowFault
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
JavaScript error running Windows packaged app #492 - GitHub
When you run npm start , you're running main.js , but when you run the packaged app, you're running index.js because Electron runs...
Read more >A Javascript Error Occurred in the Main Process Windows 10 ...
A Javascript Error Occurred in the Main Process Windows 10/8/7 FIX.The “A JavaScript error occurred in the main process” error usually ...
Read more >Javascript void error while trying to download an application ...
Can't seem to install JAVA, it said to uninstall older ones first; trying to uninstall older ones I get a message to find...
Read more >How to resolve React Native package error issue and run the ...
Trying to run an existing react native app after cloning it into my system => weather-app in windows but getting the below package...
Read more >4 Ways to Fix a Javascript Error in Windows 10 - wikiHow
1. Open your antivirus or antimalware software. If you're unable to install Discord or another app on your PC because of a JavaScript...
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
@englishextra Unlikely, it appears he’s using a pretty old version of
electron-prebuilt
, not theelectron
NPM package.@TracyGJG there are a few things that are inconsistent in your example:
electron
module (that was added in 0.35.0, but you should use the newest Electron release if possible).npm start
, you’re runningmain.js
, but when you run the packaged app, you’re runningindex.js
because Electron runs the script in themain
section ofpackage.json
(see Electron docs)devDependencies
.That being said, this doesn’t appear to be an Electron Packager specific problem at this time. You may get better help from the greater Electron community.
All working following the good advice received.
The GitHub repo https://github.com/TracyGJG/ElectronWindowFault has now been deleted.