Azure Devops: chromedriver is not a valid Win32 application - azure-devops

I am trying to run Automation Tests on Azure Devops using ChromeDriver. For that I am following below steps:
npm install -g chromedriver This works fine
chromedriver -v This works fine and gives ChromeDriver 85.0.4183.87 (cd6713ebf92fa1cacc0f1a598df280093af0c5d7-refs/branch-heads/4183#{#1689})
But when I run maven command, for ex: mvn clean verify -Dcucumber.options="--tags #smoke" -e then it gives below error.
2020-10-06T12:34:50.0688871Z Oct 06, 2020 12:34:50 PM org.openqa.selenium.os.OsProcess checkForError
2020-10-06T12:34:50.0689959Z SEVERE: org.apache.commons.exec.ExecuteException:
Execution failed (Exit value: -559038737. Caused by java.io.IOException:
Cannot run program "G:\a\..\..\_tool\node\..\..\x64\chromedriver" (in directory "."):
CreateProcess error=193, %1 is not a valid Win32 application)
Node version is v10.22.1
NPM version is 6.14.6
OS name: "windows server 2016", version: "10.0", arch: "amd64", family: "windows". It is VM and ADO Agent

There a few possible causes for the "%1 is not a valid Win32 application" message including: the pathname for the application is incorrect or the file is a 32 bit executable, but for some reason it is trying to load a 64 bit DLL.
npm install -g chromedriver It will use a global location instead of install chromedriver under the local folder, you can use the cmd npm install chromedriver and check the log then we can get the path.
If we are using npm install -g to install the program. On Windows the path could be C:\Users\YOU\AppData\Roaming\npm\node_modules, and according to the log, we can see that it run the program under G:\a\..\..\_tool\node\..\..\x64\chromedriver

Related

ChromeDriver only supports Chrome version 89

Using Azure DevOps, somehow the pipeline just stop working and I can't get the test done when I run ng lint && ng e2e && ng test --watch=false. This it's working when running local.
[16:43:25] I/launcher - Running 1 instances of WebDriver
[16:43:25] I/direct - Using ChromeDriver directly...
[16:43:27] E/launcher - session not created: This version of ChromeDriver only supports Chrome version 89
Current browser version is 88.0.4298.0 with binary path D:\a\1\s\node_modules\puppeteer\.local-chromium\win64-818858\chrome-win\chrome.exe
(Driver info: chromedriver=89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389#{#294}),platform=Windows NT 10.0.17763 x86_64)
[16:43:27] E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 89
Current browser version is 88.0.4298.0 with binary path D:\a\1\s\node_modules\puppeteer\.local-chromium\win64-818858\chrome-win\chrome.exe
(Driver info: chromedriver=89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389#{#294}),platform=Windows NT 10.0.17763 x86_64)
at Object.checkLegacyResponse (D:\a\1\s\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (D:\a\1\s\node_modules\selenium-webdriver\lib\http.js:509:13)
at D:\a\1\s\node_modules\selenium-webdriver\lib\http.js:441:30
at processTicksAndRejections (internal/process/task_queues.js:93:5)
From: Task: WebDriver.createSession()
at Function.createSession (D:\a\1\s\node_modules\selenium-webdriver\lib\webdriver.js:769:24)
at Function.createSession (D:\a\1\s\node_modules\selenium-webdriver\chrome.js:761:15)
at Direct.getNewDriver (D:\a\1\s\node_modules\protractor\built\driverProviders\direct.js:77:33)
at Runner.createBrowser (D:\a\1\s\node_modules\protractor\built\runner.js:195:43)
at D:\a\1\s\node_modules\protractor\built\runner.js:339:29
at _fulfilled (D:\a\1\s\node_modules\protractor\node_modules\q\q.js:834:54)
at D:\a\1\s\node_modules\protractor\node_modules\q\q.js:863:30
at Promise.promise.promiseDispatch (D:\a\1\s\node_modules\protractor\node_modules\q\q.js:796:13)
at D:\a\1\s\node_modules\protractor\node_modules\q\q.js:556:49
at runSingle (D:\a\1\s\node_modules\protractor\node_modules\q\q.js:137:13)
[16:43:27] E/launcher - Process exited with error code 199
##[error]Cmd.exe exited with code '1'.
This is how I set the pipeline task
puppeteer
cd node_modules/puppeteer
npm install
npm install webdriver-manager#latest
> puppeteer#5.5.0 install D:\a\1\s\node_modules\puppeteer
> node install.js
Chromium is already in D:\a\1\s\node_modules\puppeteer\.local-chromium\win64-818858; skipping download.
> puppeteer#5.5.0 prepare D:\a\1\s\node_modules\puppeteer
> node typescript-if-required.js
added 848 packages from 915 contributors and audited 860 packages in 43.745s
96 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Finishing: npm install puppeteer
ng test
ng lint && ng e2e && ng test --watch=false
According the doc: Microsoft Windows Server 2019 Datacenter and Ubuntu 20.04.2 LTS. We find there is only ChromeDriver 88.0.4324.96 on our hosted agent.
So we have two suggestions:
We noticed that the test is working well on your local machine, so we can try to install a self-agent in your local machine and use the new agent to try again.
We can add a bash task and use the below the script to install latest version of the ChromeDriver first.
npm install chromedriver --chromedriver_cdnurl=https://chromedriver.storage.googleapis.com/89.0.4389.23/chromedriver_win32.zip
since you are using javascript
yarn add chromedriver --chromedriver-force-download
or
npm install --save-dev chromedriver --chromedriver-force-download
https://github.com/giggio/node-chromedriver/issues/311

issues installing pygit2 on windows

I am trying to install
http://www.pygit2.org/install.html#installing-on-windows
As part of that I Installed in windows Cmake(Cmake-gui).
when I selected in Source code-libgit2-0.26.0 (downloaded from -https://github.com/libgit2/libgit2/archive/v0.26.0.zip)
and did configure I am getting the Error:
CMake Error at CMakeLists.txt:14 (PROJECT):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
Configuring incomplete, errors occurred!
See also "C:/Users/....GIThub/s/libgit2-0.26.0/CMakeFiles/CMakeOutput.log".
when I open the log I see only:
The system is: Windows - 6.1.7601 - AMD64
Can you please help me how I can install pygit2 on windows?

npm install -g ionic not installing in windows 8.1

I'm new to ionic framework and getting error when im trying to install ionic.
I have installed apache-ant, nodejs, cordova but when i was trying to install ionic then it throws error as follows.
OS windows 8.1 64 bit.
Please guide me to install this ionic.
\node-sass\build\binding.sln" (default target) (1) ->
(_src_\libsass target) ->
..\..\src\libsass\include\sass/base.h(18): fatal error C1083: Cannot open inc
lude file: 'stdbool.h': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
..\..\src\libsass\include\sass/base.h(18): fatal error C1083: Cannot open inc
lude file: 'stdbool.h': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
c:\users\guru.ramachandran\appdata\roaming\npm\node_modules\ionic\node_module
s\node-sass\src\libsass\src\units.hpp(10): error C2668: 'acos' : ambiguous call
to overloaded function [C:\Users\guru.ramachandran\AppData\Roaming\npm\node_mo
dules\ionic\node_modules\node-sass\build\binding.sln]
c:\users\guru.ramachandran\appdata\roaming\npm\node_modules\ionic\node_module
s\node-sass\src\libsass\src\ast.hpp(12): fatal error C1083: Cannot open include
file: 'unordered_map': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
c:\users\guru.ramachandran\appdata\roaming\npm\node_modules\ionic\node_module
s\node-sass\src\libsass\src\ast.hpp(12): fatal error C1083: Cannot open include
file: 'unordered_map': No such file or directory [C:\Users\guru.ramachandran\A
ppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln]
..\..\src\libsass\include\sass/values.h(5): fatal error C1083: Cannot open in
clude file: 'stdbool.h': No such file or directory [C:\Users\guru.ramachandran\
AppData\Roaming\npm\node_modules\ionic\node_modules\node-sass\build\binding.sln
The issue is about node-gyp module, which requires VS2013-VS2015 to build components at this time, in their README file, they say
Option 1
Install all the required tools and configurations using Microsoft's
windows-build-tools using
npm install --global --production windows-build-tools
from an elevated PowerShell or CMD.exe (run as
Administrator).
Option 2
Install tools and configuration manually:
Visual C++ Build Environment:
Option 1: Install Visual C++ Build Tools using the Default Install
option.
Option 2: Install Visual Studio 2015 (or modify an existing
installation) and select Common Tools for Visual C++ during setup.
This also works with the free Community and Express for Desktop
editions.
[Windows Vista / 7 only] requires .NET Framework 4.5.1 Install
Python 2.7 (v3.x.x is not supported), and run npm config set python
python2.7 (or see below for further instructions on specifying the
proper Python version and path.)
Launch cmd, npm config set msvs_version 2015
Source: https://github.com/nodejs/node-gyp

node-gyp build error windows x64: "fatal error LNK1181: cannot open input file 'kernel32.lib'"

Here's what I've done so far on my x64 OS:
Installed Python (v2.7 --specifically 2.7.6) and added it to the system path (C:\Python27)
Installed MS VS C++ 2010 Express Version (I already had VS 2012 but without the C++ component)
Installed the compiler update for Windows SDK 7.1
Successfully executed node-gyp configure (from my add-on directory under nodejs\node_modules where binding.gyp is located)
ran node-gyp build (as administrator)** This is what crashed, leaving me with:
this error:
C:\Program Files\nodejs\node_modules\msnodesql>node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp#0.12.2
gyp info using node#0.10.25 | win32 | x64
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
LINK : fatal error LNK1181: cannot open input file 'kernel32.lib' [C:\Program Files\nodejs\node_modules\msnodesql\build\sqlserver.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\RNelson\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Users\\RNelson\\AppData\\Roaming\\npm\\node_modules\\node- gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\Program Files\nodejs\node_modules\msnodesql
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
Any ideas as to what is going on?
I had a similar problem. I found that this switch helped me
--msvs_version=2012
so for example
npm install --msvs_version=2012 <package>
npm config set msvs_version 2013 --global worked for me as I use VS node tools and you dont need to specify msvs_version each time you do an npm install.
I had an issue whereby npm's config (c:\Users\username\ .npmrc) has an entry msvs_version=2012 which was out of date.
After spending a while to get this to work (for me accepted answer didn't work, for me it's just half solution) i did following:
Sadly, you must have visual studio (i installed express edition 2013
for DESKTOP)
Installed python 2.7.3 (you don't have to set any environment
variables)
Run cmd as administrator and go to you project root (where is you
package.json file)
First run: npm config set python C:\Python27\python.exe
Then: npm install -msvs_version=2013
The trick is in command npm config set python ...path_to_python_exe... which will be provided by npm to dependency which needs python i guess. I don't know why setting python as env variable is not enough.
If all above did not work (my case - Windows10 64bit)
Delete C:\Users\user_name\.node-gyp
Delete %AppData%/npm
Delete %AppData%/npm-cache
And install node-gyp again
Following instruction on node-gyp page
I chose Option 1 npm install --global --production windows-build-tools
For installing node-gyp in windows or any other OS
First you may have to download the node-gyp by
$ npm install -g node-gyp-install
Then install by
$ npm install -g node-gyp
you may need to do the above procedure as root/administrartor.
I had this same error now in 2015 when trying to install Keystone and I ran through all you told me but it didn't work on it's own. At the end, I just had to run the command
"C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\SetEnv.CMD" /Release /x64
to set up the environment before running the command. (Don't freak out when it turns your window text green, it's working). So yeah I'd do the installations and set up environment variables in the same way everywhere on the internet suggests but make sure to run the above command before running any other command. It probably won't be useful to you, but hopefully it's useful to someone else. If that still doesn't work, MSVS version 2010 worked for me, so install that version and use the flag -msvs_version=2010 when running the npm command.
For me the solution that worked with VS express was to simply install Visual Studio 2013 Express for desktop (which is the only one that gives you a developer command prompt as of 2013 version). Open developer command prompt (elevated) and run NPM install commands. This did not require any special --msvs_version arguments, it just worked.
I came across this problem myself, and this is how I solved it using Visual Studio 2010:
Install following packages
Python 2.7+
Visual C++ Studio 2010 Express
Windows SDK 7.1 Note: If you get error on installation, maybe this link will help you.
Visual Studio 2010 SP1
Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
Use npm install from the Windows SDK command prompt (you need this because it sets additional environment variables).
Source: node-gyp instructions for VS2010
For me (Windows 7 64bit),
I struggled with this issue for half of a day Finally It worked.
On my way :
At control panel, I deleted all Python, Microsoft Visual Studio, Microsoft Redistributable, and something about I installed to solve this.
Window Update and restart.
Installed Python27, and Visual Studio 2013 with no setting env-val
npm install node-gyp -g
I got an error same thing, but after npm config set msvs_version 2013 --global , It works.
there is an easy to use windows build tools global node package. You could try this.
I was also getting similar issues and here is what worked for me.
Removed Python and Visual Studio
Installed Python 27 and Microsoft Visual Studio with "Desktop development with C++"
Setting the python path npm config set python /path/to/executable/python
npm install node-gyp -g
node-gyp configure --msvs_version=2013
Just had the same problem. Install NVM (Node version manager) and then open your CMD and use NVM install node# followed by the version your dependencies need. If you don't know what version you might need try playing around with different version I reverted my Node back to version 14.15.0 and then used NPM install and everything ran smoothly! Hope this helps!
Install chocolatey in PowerShell with administrator permissions:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Install required versions of the Microsoft Build Tools for Visual Studio:
https://community.chocolatey.org/packages?q=visual+studio+tools
In my case:
choco install visualstudio2019buildtools
And install workload:
cinst visualstudio2019-workload-vctools
Worked with node 16.16.0
If used nvm. Reinstall node version. And all will work fine.

Eclipse maven unable to locate karma executable

I am able to run my Jasmin tests in Karma using the karma command line and maven command line, but when trying to run maven (eg. mvn install) from within STS 3.2.0.RELEASE (Eclipse Juno 4.2) I get the following error:
Failed to execute goal com.kelveden:maven-karma-plugin:1.2:start (default) on project store-webapp: There was an error executing Karma. Cannot run program "karma": error=2, No such file or directory -> [Help 1]
It's as if when Eclipse shells maven, it does not have /usr/local/bin in the path. Is there a way to configure the path eclipse uses when invoking maven?
My environment is:
Mac OSX 10.8.4
STS 3.2.0.RELEASE (Eclipse Juno 4.2)
maven-karma-plugin 1.2
karma 0.8.6 (installed globally via npm
install -g karma)
Node.js 0.10.12 (installed using the OSX package)
Jean
It appears in Mac OS X 10.8 (and possible earlier), GUI apps do not get the same path as the terminal. To add /usr/local/bin to the global path, you need to edit (and possibly create) /etc/launchd.conf to include setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin You must edit/create this file with admin privs so use sudo with vi or nano sudo nano /etc/launchd.conf You will need to reboot your Mac before this change can take effect. This information was found on ServerFault https://serverfault.com/questions/16355/how-to-set-global-path-on-os-x/277034#277034