Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Error occurred when running electron . #112

Closed
h2appy opened this issue Nov 29, 2016 · 17 comments
Closed

Error occurred when running electron . #112

h2appy opened this issue Nov 29, 2016 · 17 comments

Comments

@h2appy
Copy link

h2appy commented Nov 29, 2016

Environment:

OSX 10.11.6
Atom 1.12.6
Platformio Ide Terminal 2.2.2
Electron 1.4.10

In system terminal, it's OK when running "electron .". But in "Platformio Ide Terminal", error was returned:

module.js:457
throw err;
^
Error: Cannot find module 'electron'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. (/Users/un/Documents/electron-quick-start/main.js:1:97)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)

@oldham123
Copy link

+1

Works in CMD, but not here

@wuttimatic
Copy link

same error, please try sudo electron .

@Filipsi
Copy link

Filipsi commented Dec 13, 2016

+1

Same error on Windows 10 64x, Atom 1.12.7, Electron 1.3.13, PlatformIO IDE Terminal 2.2.2.
Works in cmd and powershell, not in PlatformIO IDE Terminal.

@boredwookie
Copy link

+1

Similar behavior except that I get this error:

App threw an error during load
Error: Cannot find module 'app'
at Module._resolveFilename (module.js:455:15)

When I run electron from a system terminal everything works fine (I'm on Lubuntu 16.04).

@DamnedScholar
Copy link

There appears to be a general error with opening any Electron applications from within Atom. I've opened an issue on the Atom repo.

@Hum4n01d
Copy link

Same issue

@matthewjumpsoffbuildings

Same issue here

@pbarbiero
Copy link

pbarbiero commented Feb 24, 2017

Well it might be an issue with pty.js -- I cant get it to accept the updated "env" object that "C:\Windows\system32\cmd.exe " in process.coffee creates. Its excluding env parameters from the list, but those parameters still ultimately show up in the terminal instance. Even if i manually override "ELECTRON_RUN_AS_NODE = 0", it still shows up as 1 once I run "set" in my terminal.

I think I am at my limit of tracing this. I still dont know if the issue is this plugin, atom.io, or pty.js now.

@pbarbiero
Copy link

Looks like its due to pty.js being outdated and not maintained.

https://github.com/Tyriar/node-pty has many, many fixes for windows (and other platforms as well). Investigating the code base differences between that and pty.js, there definitely are some environment fixes in there. And that is the root issue we are having here.

I am unable to test however, as when I build node-pty and switch platformio-atom-ide-terminal to use it instead, I get complaints about it not being a valid win32 application and I cant find a prebuilt version of it.

Definitely at my limits here for this sort of thing it seems like.

@pbarbiero
Copy link

Well I tried again, basing off of #155 (comment) using node-pty instead, however I get the same invalid win32 app, for both 32 and 64bit versions of Atom.

I seriously hope someone else can try and confirm if node-pty fixes these issues, as I would love to be able to run "electron ." from the embedded terminal without needing a separate instance.

A workaround is to manually do set ELECTRON_RUN_AS_NODE= after the terminal starts up, but I would prefer not having to do this.

@pbarbiero
Copy link

@ivankravets any input here? I unfortunately am not equipped to take it any further at this point.

@pbarbiero
Copy link

@ivankravets
As I said in #112 (comment), the issue on windows is pty.js is outdated, and the "env" variable updated in that pull does NOT get passed to the terminal instance -- that is ignored.

That was one of the very first things I tried unfortunately. This will need to be reopened, along with many of those other issues I am sure -- atleast for windows.

@pbarbiero
Copy link

@ivankravets Confirmed still broken in 2.4.0

@ivankravets
Copy link
Member

@PhillMcKraken Thanks, will wait for a PR to fix this issue.

@ivankravets ivankravets reopened this Mar 1, 2017
@pbarbiero
Copy link

pbarbiero commented Mar 1, 2017

@ivankravets I finally managed to figure out why my build was failing, I wasnt running apm rebuild properly to build the native modules properly for the current atom/electron revision.

I did confirm that this issue was resolved entirely by switching to node-pty (not to mention it is much, MUCH faster as well, along with a boatload of fixes for windows in general)

I can make a pull, but all I did was change pty.js to node-pty and included it instead of pty.js from process.coffee (see https://github.com/PhillMcKraken/platformio-atom-ide-terminal/commit/5653f119d225f09cd6053d5b9ea1b267542a228c) -- the issue here is that requires everyone to have python2.8 installed on their machine (everything else seems to be already included with the apm processes) I noticed you did some prebuild work with pty.js, that would have to be done for this as well.

I was unable to make an appveyor build work, even following your process in #155 (comment)
I can make a pull request now with that minor change as detailed above, but that wont help most people and probably would break it for more people without shipping it as a prebuilt version.

Any suggestions?

@Minyar2004
Copy link

Hi,

I have done exactly what did you describ above: i changed the two lines in pty.js and package.json, installed python2.8, but don't know how and what i have to rebuild

Can you explain how to fix this problem by steps?

Thank you

@the-j0k3r
Copy link
Collaborator

Try again with platformio-ide-terminal 2.9.0

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

No branches or pull requests