Puppeteer - Chromium | Unable to open X display | Ubuntu 20.04 - node.js

Puppeteer preinstalled chromium wasn't working at all so I installed ubuntu one by apt install chromium-browser and changed executable path to usr/bin/chromium-browser
Now, puppeteer doesn't throw any errors but I'm getting this one:
[935270:935270:1222/220755.094434:ERROR:browser_main_loop.cc(1434)] Unable to open X display.
I tried everything I red on forums but didn't work.

I am just assuming that you are executing this on a terminal only Ubuntu? In my case it was the Ubuntu Windows subsystem for Linux.
As usual when you have a solution the problem is mostly what the error says. There is no display.
Unable to open X display.
There is a solution for this called X virtual framebuffer or xvfb. https://en.wikipedia.org/wiki/Xvfb
The way I understand it it is aiming at acting as a display for all the intents of the client but is not visible to the user.
So one solution for the problem I had was to install xvfb and then run the command that requires a display with this tool. In my case it was protractor but the pupeteer command should look similar:
sudo apt-get install xvfb
xvfb-run --auto-servernum npm run protractor
PS. I got inspired by this blog entry https://remarkablemark.org/blog/2020/12/12/headless-test-in-github-actions-workflow/

Related

Failed to open X11 display - How to execute SFML output on WSL - Load WSL GUI apps

have any of you tried compile and executing SFML c++ project output on wsl?
I tried and got
Failed to open X11 display; make sure the DISPLAY environment variable is set correctly
Aborted
Is it possible at all to execute GUI applications through wsl?
(I've installed ubuntu's for wsl)
Linux distributions set up for WSL 1 will not function with Linux GUI applications, which are only supported with WSL 2.
Due to the official documentation from Microsoft regarding WSL, you might need to check these steps:
Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
after that type this command and then press enter:
wsl --update
You will need to restart WSL for the update to take effect. You can restart WSL by running the shutdown command in PowerShell.
wsl --shutdown
now, once again open powershell and type in this command:
wsl --list --verbose
You should see the number 2 for your installed distro under the heading VERSION in the response.
If everything went as planned until this point, see if your distro can open any windows by installing a GUI app like gedit and trying to open it:
sudo apt update
now install gedit:
sudo apt install gedit -y
After the installation has finished, launch gedit by typing gedit in your wsl terminal. A window from wsl inside of Windows should now open, and the issue should now be resolved.
find more information here:
https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
If you had the same problem
first, you need to install VcXsrv and X11 for executing GUI applications through wsl
then you have to add these 2 to your environment variables:
export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=0

How would you properly install MATLAB in ubuntu that is running on WSL2?

I want to install matlab in ubuntu 20.04, but I'm running ubuntu in WSL2 and it doesn't want to work.
I keep getting the error: terminate called after throwing an instance of 'framework::window::DisplayError what(): No. Display Avaliable.
I have the linux version of matlab unzipped in a folwer and I'm trying to instal it into the user files. Things I've tried to install it that were suggested for people having the same issue on other distros:
sudo ./install
./install
bash install
install
bash ./install
sudo bash ./install
sudo su and then doing ./install
export DISPLAY=:0.0 and then sudo ./install
bash ./install -v -inputFile installer_input.txt
It gives the same error for every one that I've tried.
Let me know if anyone has any solutions. Thanks.
Posting this to help out others in the future. It actually involved a few things to get this fully working properly:
1)Had to get a X Server
2)Had to change display settings in ubuntu to get it to recognize the X server and turn off some firewall features for Windows.
3)Had to when installing matlab install using the legacy install file instead of the normal install file

Mac M1 why node js is not running in OS terminal but in IDE terminals?

On a M1 MacBook Air i installed node 14.x and 16.x by NVM (NVM was installed by homebrew)
If I run node -v on iTerm or OS terminal I always get zsh: killed node -v
But if I run the same command within the integrated terminal of either VSCode, Rubymine or Marta, node runs fine yielding version number. (And I can develop using node, too)
Can someone explain why this is happening. What are the differences between the different terminals? Don't the all use same zsh in the background?
Since I had a bunch of other problems with killed processes that where installed by homebrew (and then only run after reinstalling) I decided to completely uninstall and reinstall homebrew. Not sure if it helps, but others noted this as some solution to the problem.
another helpful post:
Why does zsh kills my process every time I enter a git command
same issue, similar solution.
The below command will help in identifying which kernel you are using.
ps -p $$
Try executing the above command and compare the kernels.
If in case you wish to change your system's default kernel, you can follow below steps: -
Change the default shell to Bash by running the following command:
chsh -s /bin/bash
You’ll have to enter your user account’s password. Finally, close the Terminal window and reopen it. You’ll be using Bash instead of Zsh.
If this doesn't resolve your issue, and if you have used brew to install node and it can be related to brew installation as mentioned in the below post:
node-gets-instantly-killed-macos

How to install ChromeDriver in RedHat Linux?

I am trying to use selenium on RHEL(Red Hat).
In order to use Chrome browser, I need to install the chromedriver.
Does anyone know how to install this, or what command I need to use? I did not find any resources on this that worked.
Really appreciate any help.
Thank you.
I followed a process which worked for me.
I am using Redhat 7.4, and I've been through a lot to uninstall and install chrome and firefox, got partially successful with chrome and this is what I tried.
In the Linux terminal
Go to the root by typing
su -
Then type
rpm -qa
then (ctrl+f) and search for the keywords "google" or " chrome" or "mozilla" or "firefox" to check whether they are present or not and if they are available, then uninstall( remove ) them by the following command ( if you want to remove them )
yum remove (theWholeName)
this removes the application
Then install chrome by the following process
type this in terminal
wget
https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
then a package gets downloaded in your home folder
Then type the following command - this installs the packages
yum -y install (name of the downloaded folder with extension)
in this case it will be
yum -y install google-chrome-stable_current_x86_64.rpm
This installs google chrome and creates an icon under Application->Internet->googleChrome
IMPportant:
technically, by clicking this googlechrome icon- this should open the browser, but it doesn't open the browser for me, I dont know whats the problem and I appreciate any suggestion regarding this issue.
I open google chrome through terminal using this command
google-chrome --no-sandbox
this opens the chrome browser.

Having problems running Atom text editor on Debian Linux 9.0

I'm trying to install Atom to write Python scripts on Debian Linux 9.0. After following the installation procedure, which displayed no errors, when I start Atom all I see is a black window with the title Welcome - /home/Python - Atom, but nothing else happens. If I click around it takes me to their web site https://atom.io.
So I deleted and re-installed again, this time using the debian package atom-amd64.deb. After installing it (dpkg -i atom-amd64.deb) not a single error is displayed, but when I run it I get the same problem, a black screen and nothing else. I also tried to install atom in Lubuntu 17.04 zesty but I got same problem.
Any help to get this editor running would be appreciated.
Try this, I hope it will help you as it has helped me
wget https://atom.io/download/deb -O atom.deb
sudo dpkg -i atom.deb
sudo apt-get -f install

Resources