-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fresh project yarn dev
gives error in browser, electron does not start
#53
Comments
yarn dev
gives error in browseryarn dev
gives error in browser, electron does not start
Can you provide more detail info, like your OS version, node & yarn version? I tried on my laptop with node What I did:
|
Haven't used npx. Is it required for this project? Here's the options I used:
|
I added the following to package.json: {
"main": "scripts/dev.js"
} Then ran the following from terminal: electron . This provided the following output:
Changing line 43 of dev.js to the following:
Allows electron to start and open the window. From here, just about everything looks good, but the following is output in terminal:
After updating the above line and running from the npm script:
I get the following error and the vite server is killed before electron opens:
|
I tried on my mac (Catalina 10.15.4) with npm 7.5.3, node 15.9.0, yarn 1.22.10, and I cannot repro the situation... Can you try to recreate the project, ensuring the version is 0.0.13? From your original issue, one possible case is the preload script is not correctly loaded. Basically, you can change the const { shell, clipboard, ipcRenderer, dialog } = (window as any).electron as typeof Electron as workaround. (You need to change other file to make it at least pass the compile also) Removing that, you won't be able to access the electron module from renderer side... You can also try to create the BrowserWindow with such config: const mainWindow = new BrowserWindow({
height: 600,
width: 800,
webPreferences: {
preload: indexPreload,
contextIsolation: false, // make this false
nodeIntegration: true, // make this true
},
icon: logoUrl
}) which give less strict env for browser. Hope this can help. |
Hello, I don't unserstand why, but I got also an issue when using This is the reproduction step on the followed environnement :
> npm init electron-vue-next
? Name of the project: ElectronVueNext
? Enable node integration for renderer: Yes
? Use Service infrastructure to handle main/renderer communication: Yes
? Include thread_worker example No
? Generate vscode debug config: Yes
> yarn set version berry
Resolving berry to a url...
Downloading https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js...
Saving it into E:\Developpement\Web\Sandbox\ElectronVueNext\.yarn\releases\yarn-berry.cjs...
Updating E:\Developpement\Web\Sandbox\ElectronVueNext/.yarnrc.yml...
Done!
> yarn install
> yarn dev Everything works fine, but after I close the two windows, I try to relaunch and then : > yarn dev
TypeError: Cannot destructure property 'withFileTypes' of '(intermediate value)(intermediate value)(intermediate value)' as it is null.
at URLFS.readdirPromise (ElectronVueNext\.pnp.cjs:12609:5)
at ElectronVueNext\.pnp.cjs:15805:20
at processTicksAndRejections (internal/process/task_queues.js:77:11) Impossible to re-run the project again... An issue with the node version? Yarn berry? Thank you for this awesome project. I wanted to upgrade my knowledge with a big project I want to rework from electron-webpack to your project. |
It looks like something is |
Steps to reproduce:
npm init electron-vue-next my-project
cd my-project
yarn install
yarn dev
Server starts correctly, but opening the page in the browser shows a blank white screen. The following appears in the console:
Following is shown in terminal:
Electron never opens.
The text was updated successfully, but these errors were encountered: