Skip to content
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

Hard reset doesn't work #26

Open
ghost opened this issue Jan 20, 2017 · 12 comments
Open

Hard reset doesn't work #26

ghost opened this issue Jan 20, 2017 · 12 comments

Comments

@ghost
Copy link

ghost commented Jan 20, 2017

Hi there,

first thanks for that helpfull plugin!

A reload for the frontend-part (means changing /app/index.htm) works well. But if I define the electron-parameter the program crashes when I do make changes on the /main.js. Do you have any clue where does it come from?

Thanks in advance!

Two little fixed for your README:

  1. The line
    mainWindow.loadUrl(file://${__dirname}/index.html);
    -> The name of the function has changed loadUrl to loadURL (capital letters)
  2. And the line
    electron: require('electron-prebuilt')
    doesn't work anymore, because electron-prebuilt doesn't exist anymore.

2017-01-20 21_43_56-picturecopyandsort - c__users_hobelmann it_sync_dev_htdocs_picturecopyandsort

@yan-foto
Copy link
Owner

It seems that you are using windows if I'm right. In that case I'm afraid that I can be of no help as I only have access to *nix machines. It might be something with the way node manages spawning processes on windows. But that's just a wild guess. And I don't seem to get any useful information from the screenshot. It might be better if you could ask this on stackoverflow.

Thanks for the heads up on README corrections 👍

@yan-foto
Copy link
Owner

On second glance: do you have electron installed in your project? i.e. npm i electron so that path.join(__dirname, 'node_modules', '.bin', 'electron') exists?

@ghost
Copy link
Author

ghost commented Jan 20, 2017

Hey, thanks for quick reply! Awesome! Yes, the file exists. I found out that the problem doesn't appear when i call
./node_modules/.bin/electron main.js
directly. But when I do it then just nothing happens, when I change the main.js (when I change e.g. the app/index.html there is a reload on the view).
I also tried out with and without the following parameter
hardResetMethod: 'exit'
Do you have a clue how to debug it?
If not, I can live with it :) Thanks again for your help!

@yan-foto
Copy link
Owner

I'd suggest that you try to spawn electron from inside a node process and see what happens.

@jaheraho
Copy link

jaheraho commented Jan 25, 2017

Hi there, thanks again for the quick replying!
(its me again, using my first account)

I checked the command and it doesn't work - so its a problem with electron or spawn. I opened a issue on electron
electron/electron#8514

Another thought:
As i wrote in the ticket, when im writing the following it works (just annoying windows)
require('electron-reload')(__dirname
, {
electron: path.join(__dirname, 'node_modules', '.bin', 'electron.cmd')
}
}
So actually maybe I just need a command to start the app from my Phpstorm. (You need to know: I'm starting my electron via PhpStorm). So maybe putting '.cmd' is the solution for the "general" problem and I just need to find a way to restart the application from Phpstorm. With putting .cmd in the end it works but the following happens: Phpstorm starts electron, i change something in main.js, electron-reload quits internal Phpstorm-electron process and a new (external) command is opened. To sum it up: putting .cmd in the end is probably the solution. Its too late for me to say if I'm right or totally wrong now :)

@yan-foto
Copy link
Owner

yan-foto commented Jan 26, 2017

Good job! I will update the README so windows users doesn't get confused 👍

P.S.
Unfortunately I cannot help with PhpStorm, yet another thing, that I have no experience with!

@bkniffler
Copy link

This actually is an issue. Adding .cmd helped, though it will open a new external terminal window every time you change something and the previous terminal window will not automatically close. Can this be opened again?

@yan-foto
Copy link
Owner

The question remains: is this an electron related issue or is it something that should be taken care here. I, unfortunately, don't have a windows computer to be able to localize the problem and draft a possible solution. @bkniffler could you elaborate on the behavior and suggest some possible solutions?

@bkniffler
Copy link

I guess it must have something to do with spawn on windows. Maybe something like https://www.npmjs.com/package/cross-spawn could help.

I've found another solution that works ok (slower than electron-reload) which is nodemon: nodemon --watch * --exec "electron .".

@TomasHubelbauer
Copy link

Could the Electron not found error text also be extended to include the hint now included in the README?

Like most devs, I don't read readmes further than to the first line of example code and while I should know better, I feel like it would improve the DX to say something like Electron not found. No hard resets for you. Are you on Windows? Check out https://github.com/yan-foto/electron-reload#usage.

@yan-foto
Copy link
Owner

@TomasHubelbauer it could, but I don't want it to... the whole console.log stuff were meant to be temporary. In the next release I want to have a proper event based system with well-defined error codes. So if you wait a little bit, we'll have a better solution.

@Sti2nd
Copy link

Sti2nd commented Jan 17, 2020

It seems this is intentional from Node electron/electron#8514 so it would be great if this was worked around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants