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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to build an electron app on a Raspberry Pi using Arch linux - ARM (kernel 4.13). Since the last two days I've been facing the following error, when I start my app as usually, with the binary installed by electron-prebuilt, the following messages arises:
[485:1119/171645:ERROR:sandbox_linux.cc(345)] InitializeSandbox() called with multiple threads in process gpu-process
[628:1119/171645:ERROR:renderer_main.cc(200)] Running without renderer sandbox
[288:1119/171707:INFO:CONSOLE(338)] "Uncaught Error: Cannot find module '/home/alarm/app/node_modules/electron-prebuilt/dist/resources/atom.asar/renderer/lib/init.js'", source: module.js (338) [This is the annoying one to me ...]
[288:1119/171707:INFO:CONSOLE(2)] "Uncaught ReferenceError: require is not defined", source: file:///home/some_file.html
[288:1119/171707:INFO:CONSOLE(1)] "Uncaught ReferenceError: require is not defined", source: file:///home/some_file.html
[288:1119/171707:INFO:CONSOLE(1)] "Uncaught ReferenceError: require is not defined", source: file:///home/some_file.html
The first messages about SUID Sandbox are usual, at least the very first one, and if I'm not wrong normal since the app will share one context. The following message is the strange one to me. as it seems it arises when electron is showing the app window, in order to start electron will load atom/renderer/lib/init.js however this file is not found. At the beginning I thought that it was a problem with the electron 0.35.0 package released this morning however after several unsuccessful re-installations with different versions of electron I refused this idea. So after some googling I found that asar is a compression tool, and, as it seems node fs module is patched to be able to treat .asar files as directories, with this in mind I tried to remove the file atom.asar in APP_ROOT/node_modules/electron-prebuilt/dist/resources/atom.asar for a directory with the same name containing the .asar file information, however this didn't work since the patched fs module expect .asar files to be real .asar files. At this point I tried to compile electron by myself and obviate electron-prebuilt, at the same time I modified the file electron/atom/common/node_bindings.cc for it to search in the resources for the atom directory instead of the atom.asar file, to do this i changed the line 164 of the file from this:
And then recompile electron for arm arch. Once I did this I transfered the modified electron build to the Raspberry and tried to run my app with the new electron binary and the atom.asar file unpackaged in /electron/dist/resources/atom and I expected electron to be able to fetch my files, however when I run the app the message about atom.asar was:
The file in question exists and is readable so right now I don't now what is the next step to take. If i run the app in a Linux 64 machine no error arise, however in the Raspberry Pi the error is thrown independently of the node and electron versions. So at this point any help will be really appreciated. If you are missing information in the post please let me know.
Node versions tested:
node 5.0.0 arm >> error
node 5.1.0 arm >> error
node 0.12.7 arm >> error
node 5.1.0 x64 >> ok
node 0.12.7 x64 >> ok
node 5.0.0 x64 >> ok
node 0.10.25 >> ok
Electron versions tested:
0.33.0
0.33.7
0.34.3
0.35.0
0.35.1
Thanks in advance!
EDIT:
I've been researching a little bit more, I was more wrong than right yesterday, the error claims: Cannot find module nothing to do with the file, it is, fs module is working as expected, hence the files inside atom.asar archive are properly fetched by electron, however atom.asar/renderer/lib/init.js fails with the above mentioned error. Just to point it, I'm doing some tests and I modified atom.asar/common/lib/init.js and atom.asar/browser/lib/init.js to log some text and both files seems to be properly loaded by electron, renderer/lib/init.js still giving error ...
Thanks again!
EDIT 2:
After some more work I recompiled electron package with some additions to the file electron/vendor/node/lib/module.js. I've a copy of the generated dist directory in my Raspberry Pi home, so this will be my ELECTRON_ROOT var.
As it seems to me the function Module._findPath is not behaving properly with the path ELECTRON_ROOT/resources/atom.asar/renderer/lib/init.js. When this function calls internalModuleStat for the path ELECTRON_ROOT/resources/atom.asar/renderer/lib/init.js I get -34 as a return value, while, for example, ELECTRON_ROOT/resources/atom.asar/browser/lib/init.js returns 0, then the path is recognized properly.
To try a quick fix for this I appended one more check in the function and boolean that will evaluate to true when the path is absolute, the code is the following:
Right now I'm trying to find out where the error is thrown, in the atom.asar file the only one that seems to throw this error is atom/common/lib/asar.coffee so I will try to trace the error a little bit more ...
Thanks!
EDIT 3:
Still working on this issue, I've been adding some logging to the file atom/common/lib/asar.coffee, and to other atom core files, as it seems the file ELECTRON_ROOT/resources/atom.asar is properly recognized by the main process, however, electron refuses the file when trying to load it from renderer process. As it seems the file is created properly (I'm getting a positive number as a file descriptor) from main process, however, the renderer process is getting a -1 as a file descriptor, don't know much more right now ...
Keep on working!
Thanks!
EDIT 4:
I've redone my first change in addition to the fix introduced in EDIT 2, it is, in the line 164 of the file electron/atom/common/node_bindings.cc I've changed:
So now in my ELECTRON_ROOT/resources directory I've atom.asar and atom directory containing the unpacked information, then the renderer is not dealing with .asar files now, so now my error changed from the last Invalid package ... to:
My app is running with superuser privileges, I don't know what privileges is getting the renderer process, but it doesn't seems to be able to open the file ...
Thanks!
EDIT 5:
OK, right now I've a working installation with raspbian Jessie, uname -a:
Linux raspberrypi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux
the system nodejs and electron versions does not matter again, so, to my knowledge if raspbian jessie with kernel 4.x is able to run my app and arch arm with 4.x kernel isn't, the problem must be in some of the electron system dependencies (which will be probably newer versions in arch) ... Right now I lost my installation because my SD got corrupted at some point ... However if any tests are needed I will try to rebuild it.
Thanks!
Note: In both systems only my app is running on top of X server.
Szz.
The text was updated successfully, but these errors were encountered:
Thanks for the information, the prebuilt binaries for ARM is only guaranteed to run on Debian Wheezy, if you want to run Electron on other Linux distributions you have to custom the build yourself.
Yeahhh... I used this instructions to build electron, with each of the modifications introduced in the issue..with no luck. So that's all then, if someday I've more time I'll try again!
Hi!
I'm trying to build an electron app on a Raspberry Pi using Arch linux - ARM (kernel 4.13). Since the last two days I've been facing the following error, when I start my app as usually, with the binary installed by electron-prebuilt, the following messages arises:
[288:1119/171707:INFO:CONSOLE(338)] "Uncaught Error: Cannot find module '/home/alarm/app/node_modules/electron-prebuilt/dist/resources/atom.asar/renderer/lib/init.js'", source: module.js (338) [This is the annoying one to me ...]
The first messages about SUID Sandbox are usual, at least the very first one, and if I'm not wrong normal since the app will share one context. The following message is the strange one to me. as it seems it arises when electron is showing the app window, in order to start electron will load atom/renderer/lib/init.js however this file is not found. At the beginning I thought that it was a problem with the electron 0.35.0 package released this morning however after several unsuccessful re-installations with different versions of electron I refused this idea. So after some googling I found that asar is a compression tool, and, as it seems node fs module is patched to be able to treat .asar files as directories, with this in mind I tried to remove the file atom.asar in APP_ROOT/node_modules/electron-prebuilt/dist/resources/atom.asar for a directory with the same name containing the .asar file information, however this didn't work since the patched fs module expect .asar files to be real .asar files. At this point I tried to compile electron by myself and obviate electron-prebuilt, at the same time I modified the file electron/atom/common/node_bindings.cc for it to search in the resources for the atom directory instead of the atom.asar file, to do this i changed the line 164 of the file from this:
resources_path.Append(FILE_PATH_LITERAL("atom.asar"))
to this:
resources_path.Append(FILE_PATH_LITERAL("atom"))
And then recompile electron for arm arch. Once I did this I transfered the modified electron build to the Raspberry and tried to run my app with the new electron binary and the atom.asar file unpackaged in /electron/dist/resources/atom and I expected electron to be able to fetch my files, however when I run the app the message about atom.asar was:
[267:1120/165440:INFO:CONSOLE(338)] "Uncaught Error: Cannot find module '/home/alarm/electron/dist/resources/atom/renderer/lib/init.js'", source: module.js (338)
The file in question exists and is readable so right now I don't now what is the next step to take. If i run the app in a Linux 64 machine no error arise, however in the Raspberry Pi the error is thrown independently of the node and electron versions. So at this point any help will be really appreciated. If you are missing information in the post please let me know.
Node versions tested:
Electron versions tested:
Thanks in advance!
EDIT:
I've been researching a little bit more, I was more wrong than right yesterday, the error claims:
Cannot find module nothing to do with the file, it is, fs module is working as expected, hence the files inside atom.asar archive are properly fetched by electron, however atom.asar/renderer/lib/init.js fails with the above mentioned error. Just to point it, I'm doing some tests and I modified atom.asar/common/lib/init.js and atom.asar/browser/lib/init.js to log some text and both files seems to be properly loaded by electron, renderer/lib/init.js still giving error ...
Thanks again!
EDIT 2:
After some more work I recompiled electron package with some additions to the file electron/vendor/node/lib/module.js. I've a copy of the generated dist directory in my Raspberry Pi home, so this will be my ELECTRON_ROOT var.
As it seems to me the function
Module._findPath
is not behaving properly with the path ELECTRON_ROOT/resources/atom.asar/renderer/lib/init.js. When this function callsinternalModuleStat
for the path ELECTRON_ROOT/resources/atom.asar/renderer/lib/init.js I get -34 as a return value, while, for example, ELECTRON_ROOT/resources/atom.asar/browser/lib/init.js returns 0, then the path is recognized properly.To try a quick fix for this I appended one more check in the function and boolean that will evaluate to true when the path is absolute, the code is the following:
from this:
to this:
So now the file ELECTRON_ROOT/resources/atom.asar/renderer/lib/init.js really seems to be properly fetched, however I'm getting a new error:
"Uncaught Error: Invalid package /home/alarm/electron/resources/atom.asar", source: ATOM_SHELL_ASAR.js (119)
Right now I'm trying to find out where the error is thrown, in the atom.asar file the only one that seems to throw this error is atom/common/lib/asar.coffee so I will try to trace the error a little bit more ...
Thanks!
EDIT 3:
Still working on this issue, I've been adding some logging to the file atom/common/lib/asar.coffee, and to other atom core files, as it seems the file ELECTRON_ROOT/resources/atom.asar is properly recognized by the main process, however, electron refuses the file when trying to load it from renderer process. As it seems the file is created properly (I'm getting a positive number as a file descriptor) from main process, however, the renderer process is getting a -1 as a file descriptor, don't know much more right now ...
Keep on working!
Thanks!
EDIT 4:
I've redone my first change in addition to the fix introduced in EDIT 2, it is, in the line 164 of the file electron/atom/common/node_bindings.cc I've changed:
this:
resources_path.Append(FILE_PATH_LITERAL("atom.asar"))
to this:
resources_path.Append(FILE_PATH_LITERAL("atom"))
So now in my ELECTRON_ROOT/resources directory I've atom.asar and atom directory containing the unpacked information, then the renderer is not dealing with .asar files now, so now my error changed from the last Invalid package ... to:
"Uncaught Error: EACCES: permission denied, lstat '/home/alarm/electron'", source: fs.js (844)
My app is running with superuser privileges, I don't know what privileges is getting the renderer process, but it doesn't seems to be able to open the file ...
Thanks!
EDIT 5:
OK, right now I've a working installation with raspbian Jessie,
uname -a:
Linux raspberrypi 4.1.7-v7+ #817 SMP PREEMPT Sat Sep 19 15:32:00 BST 2015 armv7l GNU/Linux
the system nodejs and electron versions does not matter again, so, to my knowledge if raspbian jessie with kernel 4.x is able to run my app and arch arm with 4.x kernel isn't, the problem must be in some of the electron system dependencies (which will be probably newer versions in arch) ... Right now I lost my installation because my SD got corrupted at some point ... However if any tests are needed I will try to rebuild it.
Thanks!
Note: In both systems only my app is running on top of X server.
Szz.
The text was updated successfully, but these errors were encountered: