OSX fix Selenium Chromedriver launch error spawn Unknown system error -86 Bad CPU type in executable? - macos

Suddenly on the afternoon of January 6, 2021, my Selenium Protractor tests under OSX stopped working with the mysterious error
spawn Unknown system error -86
I did some research and discovered that error number 86 is the same as
Bad CPU type in executable
and ran the following to compare the cpu architecture of my chromedriver binary to my system:
% file chromedriver_87.0.4280.88
chromedriver_87.0.4280.88: Mach-O 64-bit executable arm64
% uname -a
Darwin kobl179273m 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
% uname -p
i386
How can I fix the chromedriver binary used by my Selenium so that it will run on my Intel x64 mac and clear the "system error -86" or "Bad CPU type" message?

The issue is described in https://github.com/angular/webdriver-manager/issues/476.
This has been now fixed in 12.1.8 so just update to that webdriver manager.
For most users this can be accomplished with
npm uninstall protractor && npm install protractor

Edit: this answer should be considered deprecated now that the underlying bug in webdriver-manager has been fixed. A better solution would be to upgrade to the newest version of webdriver-manager. The answer below may be useful if people need to use an older version of webdriver-manager which still has the bug.
As per Deepak Srinivasan's comment above, this error is caused by https://github.com/angular/webdriver-manager/issues/476
Root Cause:
The ChromeDriver team added "_m1" to the end of the filename for their Apple Silicon ARM builds of Chromedriver -- but both the Silicon and Intel versions of chromedriver have "mac64" in the filename, and the version number is exactly the same. This causes webdriver-manager to always download the Silicon build of Chromedriver, even on Intel macs. As a general solution, simply avoid using the chromedriver that has _m1 in its filename if you are on an Intel mac.
Solution 1: Downgrade to Chrome 86.0.4240.198 and Chromedriver 86.0.4240.22. These versions work together and are the most recent versions prior to the new and problematic support for Silicon ARM
Chrome 86 download page:
https://google-chrome.en.uptodown.com/mac/download/2920124
Disable auto-updates in Chrome: https://superuser.com/questions/1359017/how-do-i-disable-automatic-updates-of-google-chrome-on-mac-os-x
Chromedriver 86: https://chromedriver.storage.googleapis.com/index.html?path=86.0.4240.22/
% webdriver-manager update --versions.chrome=86.0.4240.22
Solution 2: Modify the webdriver-manager npm package to point to the correct chromedriver (thanks to ciekaway from the angular github issue page for this fix)
Modify the following file
node_modules/webdriver-manager/built/lib/files/file_manager.js
or, if using protractor
node_modules/protractor/node_modules/webdriver-manager/built/lib/files/file_manager.js
Near the top of the downloadFile method around line 166, add the following line to remove "_m1" from the name of the file:
fileUrl.url = fileUrl.url.replace(/_m1/, '');
It needs to be after the beginning of the .then block that starts with
binary.getUrl(binary.version()).then(fileUrl => {
it also needs to be before the next reference to fileUrl.
For example:
binary.getUrl(binary.version()).then(fileUrl => {
binary.versionCustom = fileUrl.version;
fileUrl.url = fileUrl.url.replace(/_m1/, '');
let filePath = path.resolve(outputDir, binary.filename());
Note that this solution is temporary. It will be overwritten by an npm install. The Chromedriver and/or the webdriver-manager team will probably fix this issue, at which point you should clear the modified version of your webdriver-manager and download the fix from npm.

For macOS Catalina Version 10.15.6 (19G73)
In my case I was working with Rails and Capybara for feature tests. What worked for me was
First, find the actual chromedriver location running:
which chromedriver
# Which returned:
/Users/alex/.webdrivers/chromedriver
Then, install chromedriver via Homebrew:
brew install chromedriver
Then, remove old chromedriver reference found at previous location with:
rm /Users/alex/.webdrivers/chromedriver
Now, link the old chromedriver reference to the one installed with brew:
ln -s /usr/local/bin/chromedriver /Users/alex/.webdrivers/chromedriver
Then, open Finder app, then click on Go menu and then click Go to folder ... option, and enter this route:
/usr/local/Caskroom/chromedriver/
There you should see a folder with the chromedriver version you have installed, something like this:
88.0.4324.96
Enter that folder and you should see the chromedriver binary file.
Right click on it, and click on Open
Now, you should get a terminal window popping up with the output:
Last login: Sun Jan 31 12:29:15 on ttys001
/usr/local/Caskroom/chromedriver/88.0.4324.96/chromedriver ; exit;
  ~  /usr/local/Caskroom/chromedriver/88.0.4324.96/chromedriver ; exit;
Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b- refs/branch-heads/4324#{#1784}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Finally, press Ctrl+C to stop the execution and quit the terminal window.
Now, you should be able to run capybara tests.

npm uninstall protractor && npm install protractor

If you use webdrivers gem, upgrade it:
bundle update webdrivers

Related

ddev get drud/ddev-platformsh configuration - error when generating needed environment variables on MacOS

I'm encountering an issue with undefined project variables following the installation steps outlined here: https://github.com/drud/ddev-platformsh#install
Steps 1-3 were smooth, with no issues.
On step 4 ddev get drud/ddev-platformsh, the script runs successfully until the 'Executing post-install actions:' section. Here is the output with a few preceding lines for context:
Configuration complete. You may now run 'ddev start'.
Installing project-level components:
👍 web-build/Dockerfile.platformsh
👍 homeadditions/.bashrc.d/platformsh-environment.sh
👍 platformsh/.gitignore
👍 platformsh/generate_db_relationship.sh
👍 platformsh/generate_elasticsearch_relationship.sh
👍 platformsh/generate_memcached_relationship.sh
👍 platformsh/generate_redis_relationship.sh
Installing global components:
👍 commands/web/platform
Executing post-install actions:
👍 Support composer and python3 dependencies
BASE64_ENCODE=base64 -w 0
base64: illegal option -- w
base64: illegal option -- w
👎 Installing dependencies and generating needed environment variables
could not process post-install action (2) 'Installing dependencies and generating needed environment variables'
How do I address this? The issue could be that I'm running this on MacOS, which doesn't support the -w flag for BASE64 (based on this other SO issue).
Also, I see that Platform has these environment variables: https://docs.platform.sh/development/variables/use-variables.html#use-platformsh-provided-variables
...but I'm unclear how/where they should be integrated into the DDEV config files.
Also, after encountering the config error, I ran this command, which failed and further indicated that at least one project variable was missing:
$ ddev drush cr
In Config.php line 567:
The appDir variable is not defined. Are you sure you're running on Platform.sh?
Failed to run drush cr: exit status 1
Any advice wrt how to overcome this issue would be welcome. Thank you.
My environment:
DDEV: v1.21.4
OS: MacOS Ventura 13.1
CPU: Apple M1
I think you're on macOS and you have the homebrew version of base64 installed. Unfortunately, it's quite different in its behavior. Could you please uninstall the homebrew version? brew uninstall base64 && hash -r (hash -r just makes the changes in PATH immediately effective).
See https://github.com/drud/ddev-platformsh/issues/93

Cypress Test Runner stuck at start up and have infinite loading

Even before any test execution, I've run into a problem. My Cypress Test Runner is stuck on the very beginning, and has infinite loading.
Have tried reinstalling, but still the same.
I am using MacOS Big Sur, and this is what comes up when I type cypress --version
Cypress package version: 9.2.0
Cypress binary version: 9.2.0
Electron version: 15.2.0
Bundled Node version: 16.5.0
I've also tried DEBUG=cypress:* ./node_modules/.bin/cypress open, and I get the following:
current & mean memory and CPU usage by process group:
and then table with contents, which repeats every ~10sec.
Has anyone else encountered this issue?
Found an issue, the node version was 17, and for some reason I got the error --openssl-legacy-provider is not allowed in NODE_OPTIONS
After I changed the node version to 16.x it works.

Oracle Instant Client still not working on Mac OS Catalina 10.15.4

I installed the Oracle Instant Client version 19.3 on my Mac Os Catalina version 10.15.4
But i still have the same error on python3.7 and python3.8:
Origin: (cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): no suitable image found. Did find:
file system relative paths not allowed in hardened programs". See https://oracle.github.io/odpi/doc/installation.html#macos for help
(Background on this error at: http://sqlalche.me/e/4xp6)
here is my installation:
$: ls-l ~/lib
ls -l ~/lib
total 0
lrwxr-xr-x 1 giacomocallegaro staff 58 22 Apr 09:13 libclntsh.dylib -> /Users/giacomocallegaro/instantclient_19_3/libclntsh.dylib
$: cat .zprofile
Setting PATH for Python 3.8
The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
Setting PATH for Python 3.7
The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH=$PATH:~/instantclient_19_3
export PATH
$: echo $PATH
/Users/giacomocallegaro/.nvm/versions/node/v12.14.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/giacomocallegaro/.nvm/versions/node/v12.16.1/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/opt/openssl/bin:/Users/giacomocallegaro/instantclient_19_3:/Users/giacomocallegaro/instantclient_19_3
$: which python:
/usr/bin/python
when I run sqlplus:
$: sqlplus -v
SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Can some one help me please?
Go to https://www.oracle.com/technical-resources/
Downloads --> Oracle Instant Client --> macOS(Intel x86) --> Basic Package
In your download folder you will find a folder named instantclient_19_3
Add the following to your python script
import cx_Oracle
cx_Oracle.init_oracle_client(lib_dir=r'/Users/<username>/Downloads/instantclient_19_3')
Some windows will pop up, so go to System preferences --> Security & Privacy --> General and there you will see a notification. Click on open anyway. You will have to repeat this last step 3-4 times.
After you download instant client from here, create a symbolic link into /usr/local/lib folder (that's where all .dylib files keep their symbolic links).
In my case, I extracted instant client into /opt/oracle/instantclient_19_3. So the command is:
$ ln -s /opt/oracle/instantclient_19_3/libclntsh.dylib /usr/local/lib/
However, there is another problem when I try to create the connection from python:
Error while trying to retrieve text for error ORA-01804
Oracle says: "Instant Client 19.3 and 18.1 support macOS Mojave and High Sierra", and I have macOS Catalina 10.15, don't know if this has anything to do with that, error 01804 says that timezone information is invalid.
More info on this: http://www.dba-oracle.com/t_ora_01804_start_oracle.htm
EDIT: issue resolved.
After downloading the SQL*Plus Package I managed to connect and verify the instant client works. My python issue was also resolved when I restarted IntelliJ (I was running the server from within so the PATH might have not been updated).
Maybe the error is misleading and it is related to general issue with Oracle Instant Client on MacOS Catalina? Have a look at this blog post:
Gary's Oracle On Tap
Hope this helps!

Errors with cabal 1.18.1.3 in Windows with latest Haskell Platform (2014.2.0.0)

I can't use cabal with the latest Haskell Platform (2014.2.0.0). I've tried uninstalling, removing all folders from PATH and deleting cabal's library directory, and still no luck
When I run cabal from the command line in the GitBash MINGW32 shell I get the following error:
cabal.exe init
cabal.exe: The program ghc version =6.4 is required but it could not be
found.
(cabal configure, cabal install, etc. all give the same error, except cabal --version)
Now, when I execute cabal from the windows cmd, it runs fine, but when I try to do a cabal init, I get the following:
>cabal init
Package name? [default: toyrsa]
Package version? [default: 0.1.0.0]
Please choose a license:
* 1) (none)
2) GPL-2
3) GPL-3
4) LGPL-2.1
5) LGPL-3
6) AGPL-3
7) BSD3
8) MIT
9) Apache-2.0
10) PublicDomain
11) AllRightsReserved
12) Other (specify)
Your choice? [default: (none)] 3
cabal: git: does not exist
Choosing the default or other options produces the same result. Upgrading to Cabal 1.20 does not help either.
This bug was documented here: https://github.com/haskell/cabal/issues/1613 and that issue claims that it was fixed in the 1.20 series. If you're using 1.20 and still running into it (and sure you're running 1.20 and not an older binary on your path) then you definitely should report it there and reopen the ticket.
Running cabal init from the cmd can be made to work by adding git to the PATH variable. The error at step 3 disappears then. Still seems pretty weird that I need git to create a configuration file for an empty local project with no dependencies.

Error -60005 when install Cocos2d-iPhone v3 RC4

When I try to install Cocos2d-iphone 3.0.0 RC4, I got an error: (run without sudo)
Error -60005 occurred while executing script with privileges.
So, I try to show its package content and use terminal to do: cd ...Cocos2D Installer 3.0.0.app/Contents/MacOS
I try this command: (with sudo)
sudo ./Cocos2D\ Installer\ 3.0.0
It works but I got log with some errors:
[1m>>> Installing Cocos2D-v3.0.0 files (B[m
[1m>>> Installing Cocos2D-v3.0.0 templates (B[m
[4m[1mCocos2D Template Installer (Cocos2D-v3.0.0)(B[m
Error: [31m✖︎(B[m Script cannot be executed as root.
In order for it to work properly, please execute the script again without 'sudo'.
If you want to know more about how to use this script execute '/Users/viethung/Downloads/Cocos2D-v3.0.0/install.sh --help'.
[1m>>> Building/Installing Cocos2D-v3.0.0 documentation, this may take a minute.... (B[m
appledoc version: 2.2 (build 963)
Generation step 4/5 failed: GBDocSetInstallGenerator failed generating output, aborting!
Documentation set was installed, but couldn't reload documentation within Xcode.
Xcode got an error: No documentation set present at specified path.
[1m>>> Cocos2D-v3.0.0 installation complete! (B[m
Are there any way is better than this way?
I have same problem.
I think you installed old cocos2d-iphone and it caused this problem.
You should remove old cocos2d-iphone first. I removed:
~/Library/Developer/Xcode/cocos2d v3.x
And install again. It works for me.
Hope it works for you :)

Resources