electron 1.X+ crash
Closed this issue · 6 comments
First of all thanks for all your help all this times i have posted i really apreciate your help.
i have tried to update my app to electron 1. and i am finding a crash due electron-updater. i was trying to find where it could be comming from to do a pull request to solve it, but i am unable to locate the issue.
plugin check: [ { name: 'koteky-twitter',
current: '0.0.0',
desired: '0.4.7',
valid: false } ]
Plugins are not valid.
execPath:/home/knek/code/koteky/node_modules/electron-prebuilt/dist/electron
copy appDir: /home/knek/code/koteky/node_modules/electron-prebuilt/dist
updateDir: /home/knek/.local/share/koteky/updater/1.2.0
{ Error: ENOTDIR: not a directory, stat '/home/knek/code/koteky/node_modules/electron-prebuilt/dist/resources/default_app.asar/default_app.js'
at Error (native)
errno: -20,
code: 'ENOTDIR',
syscall: 'stat',
path: '/home/knek/code/koteky/node_modules/electron-prebuilt/dist/resources/default_app.asar/default_app.js' }
seems electron has change some of the location of their files that electron-updater is looking for. Interesting enough this only happens if the update (for a plugin in my case) happens when the plugin is already in package.json on first run. if its added on the fly and an update is forced all work correctly even after restart the app.
The only workaround i have found till now is not call updater.start and relly on manually call updater.update
It may be the .asar
file. In electron they have a library that specifically treats asar files as if they are directories.
Otherwise, I hate to say it but, I don't really know without more debugging :(
yes i think you are completly correct the .asar folder is not there anymore. Is it critical for electron updater?.
could you explain me if its not to complex why it happends? I was trying to find the reference on your code to this missing file, but i was unable to understand it.
a few screenshots of the error (the behavior is basically it will stay in an infinite loop of error windows):
Hello @kanekotic @justinmchase , Did you solved the problem? I think i have the same problem now!
ljq% electron .
Update is pending, exiting...
execPath:/usr/local/lib/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron
copy appDir: /usr/local/lib/node_modules/electron-prebuilt/dist/Electron.app
updateDir: /Users/yq/Library/Application Support/besst-pack/updater/1.2.2
{ Error: ENOTDIR: not a directory, stat '/usr/local/lib/node_modules/electron-prebuilt/dist/Electron.app/Contents/Resources/default_app.asar/default_app.js'
at Error (native)
errno: -20,
code: 'ENOTDIR',
syscall: 'stat',
path: '/usr/local/lib/node_modules/electron-prebuilt/dist/Electron.app/Contents/Resources/default_app.asar/default_app.js' }
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
updater = require('electron-updater');
var mainWindow = null;
app.on('ready', function () {
updater.on('ready', function () {
mainWindow = new BrowserWindow({width: 800, height: 600});
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.openDevTools({detach: true});
mainWindow.on('closed', function () {
mainWindow = null;
})
});
updater.on('updateRequired', function () {
app.quit();
});
updater.on('updateAvailable', function () {
mainWindow.webContents.send('update-available');
});
updater.start()
});
so this is coming from updater.start
i have work around it using:
updater.update((err) => {
if (err)
console.log(err);
menu.window.webContents.send('initialize');
});
Basically i dont start the periodical check, i just force the process on my app start or when someone request the installation of a plugin.
there is also another requirement, if you are going to use electron-builder
to generate your cross-platform installer you will need to add this option on your package.json
"build": {
"asar": false
}
is not a perfect solution, but it fulfils my requirements. As for me the most important part is to have a plugin architecture to extend my app.
i have the same problem and i use a solution of @kanekotic but it still
Project on NPM since version 1.0.0 is a part of electron-builder.