- Electron Version: 2.0.4
- Operating System (Platform and Version): Windows 10 Home
- Last known working Electron version: 2.0.4
I’ve just got this error, don’t know where it’s coming from.
App threw an error during load
Error: Cannot create BrowserWindow before app is ready
at Object. (C:UsersdeyanDesktopfortnitebrmain.js:8:14)
at Object. (C:UsersdeyanDesktopfortnitebrmain.js:39:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at loadApplicationPackage (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:287:12)
at Object. (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:328:5)
at Object. (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:365:3)
This is the code.
const electron = require(‘electron’);
// const app = electron.app;
// const BrowserWindow = electron.BrowserWindow;
// const Menu = electron.Menu;
const {BrowserWindow, app} = require(‘electron’);
mainWindow = new BrowserWindow({width: 800, height: 600, frame: false});
(function () {
var remote = require(‘remote’);
var BrowserWindow = remote.require(‘browser-window’);
function init() {
document.getElementById(«min-btn»).addEventListener(«click», function (e) {
var window = BrowserWindow.getFocusedWindow();
window.minimize();
});
document.getElementById("max-btn").addEventListener("click", function (e) {
var window = BrowserWindow.getFocusedWindow();
window.maximize();
});
document.getElementById("close-btn").addEventListener("click", function (e) {
var window = BrowserWindow.getFocusedWindow();
window.close();
});
};
document.onreadystatechange = function () {
if (document.readyState == «complete») {
init();
}
};
})();
My app works.
not works and I got an error like this.
Uncaught Exception:
Error: Cannot create BrowserWindow before app is ready
at createWindow (/Users/tom/Documents/wsWP/react-cn-mirrot/build/CN-Mirror-darwin-x64/CN-Mirror.app/Contents/Resources/app/main.js:11:24)
at App.<anonymous> (/Users/tom/Documents/wsWP/react-cn-mirrot/build/CN-Mirror-darwin-x64/CN-Mirror.app/Contents/Resources/app/main.js:98:9)
at App.emit (events.js:210:5)
same error like #14425, #13669. But maybe I found the reason about this error.
I cloned my project from electron-quick-start
and I built my app.
I clicked the icon when my app was jumpping in the dock, I got this error :
Uncaught Exception:
Error: Cannot create BrowserWindow before app is ready
at createWindow (/Users/tom/Documents/wsWP/react-cn-mirrot/build/CN-Mirror-darwin-x64/CN-Mirror.app/Contents/Resources/app/main.js:11:24)
at App.<anonymous> (/Users/tom/Documents/wsWP/react-cn-mirrot/build/CN-Mirror-darwin-x64/CN-Mirror.app/Contents/Resources/app/main.js:98:9)
at App.emit (events.js:210:5)
I think the activate
event was received by app and it was not ready, so the app was trying to create a new window.
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
})
Finally , I removed this function . It works.
I think the activate
event should not be send when the app is starting.
Is this a bug?
Содержание
- Error: Cannot create BrowserWindow before app is ready #13669
- Comments
- Following documentation, yet «Cannot create BrowserWindow before app is ready» #14425
- Comments
- Footer
- Jenkins Pipeline Error «Cannot create BrowserWindow before app is ready» #918
- Comments
- Is this a Feature or Bug?
- Current behavior:
- Desired behavior:
- Error: Cannot create BrowserWindow before app is ready #540
- Comments
- Preflight Checklist
- Uncaught Exception: Cannot create BrowserWindow before app is ready #361
- Comments
- Steps to reproduce
- What I expected
- What happened instead
- OS version
- Screenshot / Video
- Footer
Error: Cannot create BrowserWindow before app is ready #13669
- Electron Version: 2.0.4
- Operating System (Platform and Version): Windows 10 Home
- Last known working Electron version: 2.0.4
I’ve just got this error, don’t know where it’s coming from.
App threw an error during load
Error: Cannot create BrowserWindow before app is ready
at Object. (C:UsersdeyanDesktopfortnitebrmain.js:8:14)
at Object. (C:UsersdeyanDesktopfortnitebrmain.js:39:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at loadApplicationPackage (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:287:12)
at Object. (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:328:5)
at Object. (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:365:3)
This is the code.
const electron = require(‘electron’);
// const app = electron.app;
// const BrowserWindow = electron.BrowserWindow;
// const Menu = electron.Menu;
var remote = require(‘remote’);
var BrowserWindow = remote.require(‘browser-window’);
function init() <
document.getElementById(«min-btn»).addEventListener(«click», function (e) <
var window = BrowserWindow.getFocusedWindow();
window.minimize();
>);
document.onreadystatechange = function () <
if (document.readyState == «complete») <
init();
>
>;
The text was updated successfully, but these errors were encountered:
Источник
Following documentation, yet «Cannot create BrowserWindow before app is ready» #14425
- Output of node_modules/.bin/electron —version : v2.0.8
- Operating System (Platform and Version):
- ProductName: Mac OS X
- ProductVersion: 10.13.6
- BuildVersion: 17G65
Actual behavior
If you provide a URL, please list the commands required to clone/setup/run your repo e.g.
Notes
It’s been a long time since I made an electron app and all the documentation is different, but literally copying the examples doesn’t seem to work for me.
The text was updated successfully, but these errors were encountered:
As per the error message you can’t construct BrowserWindow instances before the app is ready. You need to wait for the ready event on the app object.
Sorry, I guess I wasn’t clear. It’s not that I don’t know how to make this work, it’s that the documentation below suggests that I don’t even need the ready event:
Are these snippets wrong?
I wouldn’t call them wrong, but I can see how people can run into this issue by simply copy pasting those snippets and not having the full context from other tutorials / docs. These snippets aren’t really designed to be functioning apps and I don’t want them to all become bloated with app.on(‘ready’) or app.whenReady.then() calls. Do you have any suggestions for how to make this clear without bloating the code examples?
I guess the one that really tripped me up was https://electronjs.org/docs/api/browser-window#using-ready-to-show-event which explicitly seems to tell me there’s an alternative. This is hard problem, I don’t envy that. Thanks for the insight.
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Jenkins Pipeline Error «Cannot create BrowserWindow before app is ready» #918
Is this a Feature or Bug?
Current behavior:
Running Cypress on a Jenkins build pipeline returns the following error:
Desired behavior:
Run cypress as part of the testing stage in Jenkins pipeline.
- Operating System: MacOS 10.12.6
- Cypress Version: 1.0.3
The text was updated successfully, but these errors were encountered:
Interesting, how can we recreate this failure? Is there a small example public repository that shows this behavior?
My tests started running randomly but then this issue came up again. After looking into it more, I noticed the tests started working after changing the way I was defining env vars in my Jenkinsile. I made dynamic env vars with bash scripts grabbing the current branch name and date for naming reports that I am autogenerating.
When ran a simple cypress run with no extra arguments, my tests started running again.
With Jenkin’s crazy idiosynchrasies I think I will find another way to get this information or just have simpler report titles. this caused too many headaches for me.
Just found out that I have the same problem. I will try to reproduce it in a public repo.
has somebody found a workaround?
Funny enough I got this error again yesterday evening when we reset our build server. This time I notice this in the logs before the ‘BrowserWindow’ error came up.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL
Last time I debugged this issue, I physically logged in on the machine and ran the cypress tests myself during debugging, and never logged off. I think this may be our answer, going to try it out when I get into work.
No luck with having the account logged in. I was able to run cypress manually but the automated cypress command doesn’t work.
Seems like this error is specific to MacOS, ran on our Jenkins server running on Ubuntu and everything is working fine. Possible fix could be using Cypress’s docker image?
Same issue on Mac High Sierra v10.13.6
Working fine on Ubuntu 18.04
I’ve Mojave 10.14.2 (18C54) and I’m still getting the same problem. I have Jenkins locally installed on my mac and I want to run the sample tests
Can you attempt to follow these directions? May be related to Jenkins permissions issues https://stackoverflow.com/a/21028195/5878476
Can you attempt to follow these directions? May be related to Jenkins permissions issues https://stackoverflow.com/a/21028195/5878476
Probably not related to permission, I did whatever this thread suggesting me but got no lucky.
I’m attempting to run some cypress tests on SemaphoreCI within their OSX environment and am encountering this issue as well.
OSX : 10.14.5
Kernel: Darwin 18.6.0
When running «cypress run», the following error shows:
After searching around, I haven’t found a way to get this to work. So I resorted to installing Chrome, ie brew install caskroom/cask/google-chrome . This installed Chrome 75 as of this writing.
After installing Chrome into /Applications, I then run cypress run -b chrome , which it was able to run the test with the full log output here:
So it appears that one is actually able to run the test, but it’s just not able to run the test using electron chromium browser, but it’s able to run it using the external Chrome app.
This now appears to be more of a Cypress issue more so than SemaphoreCI’s OSX. It also appears that the errors are different between running under electron vs chrome.
Источник
Error: Cannot create BrowserWindow before app is ready #540
Preflight Checklist
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Download the Mac dmg file (14.5.1) from the releases page
- Run the installer
- Drag the app icon into Applications
- Open the .app file in the Applications folder
- Select the affirmative on the MacOS security prompt
- Observe the error,
- Click OK
- Observe app opens and seems normal
Note: I have not tested to see if the application is working as it should. It’s possible this error is benign but I still thought I should report it.
Expected behavior
app should have opened without error
Screenshots
If applicable, add screenshots to help explain your problem.
draw.io version (In the Help->About menu of the draw.io editor):
14.5.1
Desktop (please complete the following information):
- OS: MacOS 11.2.3
The text was updated successfully, but these errors were encountered:
Источник
Uncaught Exception: Cannot create BrowserWindow before app is ready #361
Steps to reproduce
- I opened the app from the dock (I think for the first time after restarting my laptop)
- The app loaded but an error popped up above it
What I expected
The app to open.
What happened instead
The app opened with this error popup:
After I closed the popup message the app continued to work without any apparent issues.
OS version
Mac OS X 10.11.6 (15G31), Simplenote version 1.0.1
Screenshot / Video
The text was updated successfully, but these errors were encountered:
Thanks @rachelmcr. This should be an easily fixable bug.
Has this happened to you more than once? Is there a pattern? If it’s a rare fluke we will probably address it later as time permits but if it’s happening a bunch and we don’t realize it then we can try and take care of it more immediately.
Yes, it happens every time I first open the app after restarting my laptop. It isn’t a huge deal (I can dismiss the alert and move on) but it is a consistent, recurring thing.
Going to close this for now, haven’t seen other reports and we have the native macOS app up to par w/ electron.
I know this is late but apparently this error has to do with the way you set your callback to ‘ready’ event.
Instead of passing the function instance ‘callback’, you might had passed ‘callback()’, which caused the app to call the callback function once the set callback is executed, which happens before ‘ready’ event
@nefory thanks for chiming in! if that’s the case as you present it then our lack of types strikes again!
did you notice where this might be going on? I tried to find it but when I looked I was thinking that the error was likely triggered in desktop/app.js but looking back over the past three years of the call to app.on( ‘ready’, … ) I couldn’t find the proposed mistake.
where did you find it?
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
I am new to Electron and I followed the documentation to just create my first hello world application using electron, but I have this error :
> [email protected] start C:UsersuserDesktopElectronelc
> electron .
App threw an error during load
Error: Cannot create BrowserWindow before app is ready
at createWindow (C:UsersuserDesktopElectronelcmain.js:10:11)
at Object.<anonymous> (C:UsersuserDesktopElectronelcmain.js:23:16)
at Object.<anonymous> (C:UsersuserDesktopElectronelcmain.js:41:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at loadApplicationPackage(C:UsersuserDesktopElectronelcnode_moduleselectrondistresourcesdefault_app.asarmain.js:287:12)
at Object.<anonymous> (C:UsersuserDesktopElectronelcnode_moduleselectrondistresourcesdefault_app.asarmain.js:329:5)
And a pop-up telling me the same thing, And I don’t know how to solve the problem.
That is my file main.js :
const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')
let win;
function createWindow() {
win = new BrowserWindow({width:200,height:300});
win.loadURL(url.format({
pathname: path.join(__dirname,'index.html'),
protocol: 'file:',
slashes: true
}));
win.webContents.openDevTools();
win.on('closed',()=>{
win=null;
})
}
app.on('ready',createWindow())
app.on('window-all-closed',()=>{
if(process.platform !== 'darwin'){
app.quit();
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
And that is my html code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Electron Quick Start</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
And that my file package.json :
{
"name": "tofita",
"version": "1.0.0",
"description": "tofita",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"author": "Tofita",
"license": "ISC",
"dependencies": {
"electron": "^1.8.2"
}
}
I get the error after executing the ‘ npm start ‘ command.
I hope my problem was well explained, any help would be much appreciated.
- Electron Version: 2.0.4
- Operating System (Platform and Version): Windows 10 Home
- Last known working Electron version: 2.0.4
I’ve just got this error, don’t know where it’s coming from.
App threw an error during load
Error: Cannot create BrowserWindow before app is ready
at Object. (C:UsersdeyanDesktopfortnitebrmain.js:8:14)
at Object. (C:UsersdeyanDesktopfortnitebrmain.js:39:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at loadApplicationPackage (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:287:12)
at Object. (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:328:5)
at Object. (C:UsersdeyanDesktopfortnitebrnode_moduleselectrondistresourcesdefault_app.asarmain.js:365:3)
This is the code.
const electron = require(‘electron’);
// const app = electron.app;
// const BrowserWindow = electron.BrowserWindow;
// const Menu = electron.Menu;
const {BrowserWindow, app} = require(‘electron’);
mainWindow = new BrowserWindow({width: 800, height: 600, frame: false});
(function () {
var remote = require(‘remote’);
var BrowserWindow = remote.require(‘browser-window’);
function init() {
document.getElementById(«min-btn»).addEventListener(«click», function (e) {
var window = BrowserWindow.getFocusedWindow();
window.minimize();
});
document.getElementById("max-btn").addEventListener("click", function (e) {
var window = BrowserWindow.getFocusedWindow();
window.maximize();
});
document.getElementById("close-btn").addEventListener("click", function (e) {
var window = BrowserWindow.getFocusedWindow();
window.close();
});
};
document.onreadystatechange = function () {
if (document.readyState == «complete») {
init();
}
};
})();
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.