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

How to run nightmare correctly (shell, VM)? #937

Closed
R0byn opened this issue Dec 29, 2016 · 5 comments
Closed

How to run nightmare correctly (shell, VM)? #937

R0byn opened this issue Dec 29, 2016 · 5 comments

Comments

@R0byn
Copy link

R0byn commented Dec 29, 2016

Hi,
that's not really an issue I think but don't know where else to ask:
Coming from phantomjs (but with poor general knowledge) I tried to run the Yahoo search example in a shell, on Windows, connected to an Ubuntu Server on which nightmare resides, the Ubuntu server runs in a VM. Result: No errors, but also no console output. Only the simplest hello-world-output worked.
After hours of research I found issues regarding nightmare & vfb on Ubuntu Server. So I thought it might be a good idea to try the thing with Ubuntu Desktop VM.
Again on Windows I fired up the shell, connected to the Ubuntu VM, tried the Yahoo Search example - nothing.
Then tried the example in a shell on the Ubuntu Desktop - voila! Worked! :-)
Now please let me understand why it seems to work only in a shell on the Ubuntu Desktop but not in a remote shell? What can I do to get it to work in a remote shell? Thanx!
EDIT: Actually in the long term I would like to get my project to work on the Ubuntu server, without any onscreen user interactions.

@jekku
Copy link
Contributor

jekku commented Dec 29, 2016

Quick question, what does the config say? Are you setting 'show' to true? Because I'm using nightmare for tests, and is being pushed to a CI (Which is similarly, a shell ONLY env). And it works.

@R0byn
Copy link
Author

R0byn commented Dec 29, 2016

With show: false it's the same: works on the Desktop but not in the remote shell.

@jekku
Copy link
Contributor

jekku commented Dec 29, 2016

Understood. In the CI containers, I think they install Xfce / X server - something that has display capabilities. Try installing them to the shell OS and then run the nightmare script. This is called 'headless running'

You can also check:

#224

I suggest this issue to be closed @rosshinkley

@R0byn
Copy link
Author

R0byn commented Dec 29, 2016

Hmm... so in my case it would require to install Xfce or something similar on the Ubuntu server, right?
Is there a way to get nightmare scripts running with this combination, while developing:

  • nightmare and nodejs reside on Ubuntu server with Xfce
  • Putty shell (connected to that Ubuntu server) is executed on Windos
  • want to manually test nightmare scripts in that Putty shell

@rosshinkley
Copy link
Contributor

@R0byn as @jekku mentioned, give #224 a read.

So starting from the top, explaining what you're seeing:

Result: No errors, but also no console output.

In the future, try running with DEBUG=nightmare*,electron* or DEBUG=*. That will yield more verbose, useful output.

Then tried the example in a shell on the Ubuntu Desktop - voila! Worked! :-)

This is because when you're under an Ubuntu desktop, you're running an X session of some flavor, meaning there's a framebuffer running. Electron requires a framebuffer to be running to work properly.

... and is being pushed to a CI (Which is similarly, a shell ONLY env).

Most (all?) of the CI solutions I've seen have a framebuffer of some flavor running (usually xvfb).

Is there a way to get nightmare scripts running with this combination

Yes. Install Xvfb, read through #224 and the suggestions there. You can either have Xvfb always running or use xvfb-run to manage starting/stopping the service for you. Your setup under that scenario should work fine.

I'm going to merge this into #224 and close this issue.

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

No branches or pull requests

3 participants