Why Doesn't Electron Work in Cloud9?


#1

Things That Don’t Work

I am fairly new to programming. I was trying to do a ‘quick start’ tutorial for the Electron Framework but received error messages when trying to run npm start. I have also noticed when learning express that I can’t just create a server listening on a port and then navigate to that port on localhost.

What Actually Works

Instead I have to use process.env.PORT then instead off navigating to localhost:<port> I can view my server output on https://<workspaceName>-<username>.c9users.io

Questions

  • In the case of both Electron and Express how come things work differently on Cloud 9. I am a newb but I realize documentation is written from the perspective of a user executing the commands locally and Cloud 9 is well, in the cloud. Is the documentation somewhere that I can read to understand what cloud 9 actually is in a little more detail?

  • So like I said i figured out how to make express work, but with Electron I am not sure. It is supposed to work with your native system and essentially creates a chromium browser window with whatever html, css, js you want to put in it…at least thats my newb understanding of it. How would I get Electron to work from Cloud 9? And why doesn’t it work out of the box like it presumably would if everything was done locally.

Sidenote

  • I only own a chromebook so I don’t really have any other options at the moment for accessing Electron…at least that I know about.

Thanks for taking time to help.


#2

I’d recommend taking a look at what Mutahhir said in this thread: How do i test my Electron Apps here

Essentially, you won’t be able to run Electron itself on the Cloud9 IDE, but you will be able to point Electron to use the IDE preview on your local machine.

Hope this helps!


#3

thanks for the reply. starting to understand. sounds like i will be able to that eventually. i am still developing my understanding of things. when he says Give the BrowserWindow the url for your Cloud9 workspace application is that url https://<workspaceName>-<username>.c9users.io depending on the user and name of workspace obviously? i get the BrowserWindow part


#4

Yup! That should be it. That way, Cloud9 will serve up the content and Electron will act as a browser window.


#5

thanks again. he mentions that cloud 9 has no display as part of why electron can’t directly render something. i wonder if it is possible that in the future to somehow have a virtual display where you could use localhost: and electron would just work. like how you get MEMORY and CPU in each new workspace you would just get DISPLAY. :hamburger:

like i mentioned before i though i really don’t get what each new workspace in cloud 9 even is! but i like that they work!