Unable to find chrome binary in WSL while running Rails tests - ruby-on-rails

I am trying to run integration tests for my Rails application in Windows Subsystem for Linux. I have downloaded the chromedriver file for windows from the official site and placed it in Documents/bin folder. I have added the following file in the same folder and saved it as chromedriver:
#!/bin/sh
chromedriver.exe "$#"
So presently Documents/bin folder has these two files: chromedriver.exe and chromedriver. I have added this folder to PATH in windows.
When I type chromedriver -v in Ubuntu terminal in Windows I get the following output:
ChromeDriver 75.0.3770.90 (a6dcaf7e3ec6f70a194cc25e8149475c6590e025-refs/branch-heads/3770#{#1003})
But when I execute any Rails integration test I am getting the following error:
sh: 1: ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/opt/google/chrome"]: not found
sh: 1: ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/opt/google/chrome"]: not found
sh: 1: ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/opt/google/chrome"]: not found
Webdrivers::VersionError: Failed to find Chrome binary or its version.
chrome version in windows: Version 75.0.3770.90 (Official Build) (64-bit)
So linux is able to find chromedriver but not rails. How can I rectify this error? Should I run sudo apt-get install chromium chrome-driver? Or is there another method to make rails know the path to chromedriver binary?

You need to add the path to your chrome.exe to the PATH environment variable in Ubuntu

Related

Command failed with a non-zero return code (123)

I am running into an issue when I try to generate a build with electron-packager (npx electron-packager . --platform=win32 --arch=x64). On Windows with intel chip (inside guext linux vm) the same config (package.json) and same command yield a good *.exe application. However, when I try this inside a guest vm Linux on a macOS arm64, I run into :
Command failed with a non-zero return code (123) : wine64 ...
parameters ...
I haven't found an explanation in the wine website. I also looked online but without any luck. I noticed that I don't have wine32 and wine sometimes recommend the installation. Note that the command does not include the ia32 arch.
In any case, I tried the complete reinstallation of wine on a new guest vm (Ubuntu 22.04). After following the step by step from wineHQ website, I run into the same problems, including when I enter the last command :
sudo apt install --install-recommends winehq-stable
Where the error is :
wine-stable:i386 : Depends libc6:i386 (>= 2.34) but it is not
installable
I tried to install this package but to no avail (libc6:i386; no installation candidate), I did follow the answer here and still no candidate. Package replacing it (libdb1-compat libnss-nis libnss-nisplus libcrypt1) were installed but still no luck.
Not all the time, but sometimes, Ubuntu report a crash of wine64 when running npx electron-packager... . In it is possible to find UnreportableReason : You have some obselete package version installed... libcurl4, libsasl2-2, libsasl2-module, libsasl2-modules-db. -> I did upgrade those, but that does not change the result of the electron-package command. In the Stacktrace the backtrace is stopped due to "cannot access memory at address xxxxxxx".
I also tried to move the project folder directly into a locally emulated drive of the Linux vm, but that does not have a different outcome.
Finally, I also tried to remove the option --out, --ico, etc. and ended up just running :
npx electron-packager . --platform=win32 --arch=x64
I am out of idea.

Docker machine installation for windows

I just installed docker-machine for windows using the following command:
It created a bin folder with a docker-machine.exe file.
However after checking if it installed correctly with docker-machine version. I get the following error:
/c/Users/samta/bin/docker-machine: line 1: syntax error near unexpected token `<'
Fixed it I download the docker-machine.exe file for windows from github: https://github.com/docker/machine/releases/
and replaced the generated file from the command above.

Symfony Docker PHPunit Fatal error: require(): Failed opening required

I have a problem when i try to execute php bin/phpunit from docker.
Warning: require(/user/project/bin/.phpunit/phpunit-7.5-0/vendor/composer/../symfony/phpunit-bridge/bootstrap.php): failed to open stream: No such file or directory in /user/project/bin/.phpunit/phpunit-7.5-0/vendor/composer/autoload_real.php on line 69
If i execute php bin/phpunit from terminal in my computer it works.
If i delete phpunit folder from /bin directory in symfony project and i try to execute php bin/phpunit from docker it works (after phpunit re-installation in /bin folder) on docker machine but not on my pc. Perhaps the problem is in symlink but i'm not able to solve this issue.
Please be sure that when you build your container you execute the composer install command.
If the problem still persist please share a snap of your Dockerfile

Heroku error in Gitbash Windows 10

I cannot get Heroku to work in Gitbash on windows 10.
Gitbash version = 1.9.4.msysgit.2
Error Messages:
$ heroku version
/c/Program Files (x86)/heroku/bin/../client/bin/heroku.cmd:
line 1: #echo: command not found
/c/Program Files (x86)/heroku/bin/../client/bin/heroku.cmd:
line 2: setlocal: command not found
/c/Program Files (x86)/heroku/bin/../client/bin/heroku.cmd:
line 4: syntax error near unexpected token `('
/c/Program Files (x86)/heroku/bin/../client/bin/heroku.cmd:
line 4: `if not "%HEROKU_REDIRECTED%"=="1" if exist "%LOCALAPPDATA%\heroku\client\bin\heroku.cmd" ('
Any help is much appreciated!
Thank you,
Boba Fett
My Windows Environment Variables
The Error Messages in Gitbash
I was receiving the same error after I corrected the Path variable. What worked for me was installing a standalone version via bash. Uninstall the version of heroku that you have and then, in your shell, run the command curl https://cli-assets.heroku.com/install.sh | sh
Try using regular windows command prompt (cmd.exe) to test the heroku version heroku --version to confirm it is installed and also try to check where it is installed using the where heroku command

CircleCI CLI Error on Ubuntu WSL: open .circleci/config.yml: no such file or directory

I'm trying to get the CircleCI CLI tool ( https://circleci.com/docs/2.0/local-jobs/ ) working on Ubuntu WSL on Windows 10. It appeared to install successfully -- and the file permissions appear to be correct. I have Docker for Windows installed and running, and the Linux Docker client works without issue.
But now it always errors when trying to validate a CircleCI config file.
I have tried:
circleci config validate -c .circleci/config.yml
and
circleci config validate
from the root of my repo.
But each time, it gives the error:
Error: open .circleci/config.yml: no such file or directory
Has anyone been able to get this work?
sudo worked for me to overcome this. However, I stuck with the next error.

Resources