[英]GithubElectron: A JavaScript error occured in the browser process
I installed "electron-packager" using npm and executed the command 我使用npm安装了“ electron-packager”并执行了命令
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) 然后,当我运行“ Johnston.app”时,出现了此错误(我什至没有看到主窗口)
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.
未捕获的异常:错误:在Module.require(module.js :)的Function.Module._load(module.js:282:25)的Function.Module._resolveFilename(module.js:332:15)上找不到模块'electron' 361:17)在Object处require(module.js:380:17)。 (/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/app/main.js:3:18)位于Object.Module._compile(module.js:426:26)。在Object的Function.Module._load(module.js:306:12)的Module.load(module.js:351:32)处的Module._extensions..js(module.js:444:10)。 (/Users/David/Github/Johnston/Johnston-darwin-x64/Johnston.app/Contents/Resources/atom.asar/browser/lib/init.js:104:10)
(/Users/David/Github/Johnston/Johnston-darwin-x64/Johnston.app/Contents/Resources/atom.asar/browser/lib/init.js:104:10)
Is there any solutions? 有什么解决办法吗? Thanks!
谢谢!
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. 这可能与您要用来构建机器的计算机上安装了不同版本的Electron有关。 In the folder for your app, run
electron --version
to get the version of electron that you have installed. 在应用程序的文件夹中,运行
electron --version
获取已安装的电子版本。 Then, change the --version=0.36.0
to use whatever version you have installed. 然后,将
--version=0.36.0
更改为使用已安装的任何版本。
If that doesn't fix it, then you should try rm -rf node_modules && npm install
on your project. 如果那不能解决问题,则应在项目上尝试
rm -rf node_modules && npm install
。 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.
如果那不起作用,请在这里发表评论,我会再次尝试提供帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.