David
David

Reputation: 1680

GithubElectron: A JavaScript error occured in the browser process

I installed "electron-packager" using npm and executed the command

electron-packager . Johnston --platform=darwin --arch=x64 --version=0.36.0

And then I when I run the "Johnston.app", this error showed up (I didn't even see the main window)

Uncaught Exception: Error: Cannot find module 'electron' at Function.Module._resolveFilename (module.js:332:15) at Function.Module._load (module.js:282:25) at Module.require (module.js:361:17) at require (module.js:380:17) at Object. (/Users/David/Github/Johnston/Johnston-darwin-x64/Johnston.app/Contents/Resources/app/main.js:3:18) at Module._compile (module.js:426:26) at Object.Module._extensions..js (module.js:444:10) at Module.load (module.js:351:32) at Function.Module._load (module.js:306:12) at Object. (/Users/David/Github/Johnston/Johnston-darwin-x64/Johnston.app/Contents/Resources/atom.asar/browser/lib/init.js:104:10)

Is there any solutions? Thanks!

Upvotes: 1

Views: 2146

Answers (1)

frosty
frosty

Reputation: 21762

This likely has something to do with you having a different version of Electron installed on your machine that you are using to build with. In the folder for your app, run electron --version to get the version of electron that you have installed. Then, change the --version=0.36.0 to use whatever version you have installed.

If that doesn't fix it, then you should try rm -rf node_modules && npm install on your project. This will remove you node modules and then reinstall them all. If that doesn't work, please comment here and I will try to help again.

Upvotes: 1

Related Questions