Ubuntu Nightwatch docker image used by Jenkins fails at 'npm i' if chromedriver >= 80. When chromedriver <= 79 Everything is fine. Where chromedriver is defined in package.json

119 views
Skip to first unread message

Brian Annett

unread,
Jun 29, 2020, 6:00:33 AM6/29/20
to NightwatchJs
Hi All  (1st post)

We run Nightwatch via Jenkins using a Ubuntu docker image. The nightwatch Jenkins build pipeline does an 'npm i' to install Nightwatch on the docker image. I'll add the Dockerfile at the bottom for reference. Historically this has worked very well whilst Chrome needed Chromedriver <= 79.

However I have recently tried to build a new image, removing a dependency on docker-hub. Only to discover that both my new image and the original, during 'npm i' throw an error when trying to install chromedriver >=80

Where chromedriver is defined in package.json
  "devDependencies": {
    "chromedriver": "^83.0.0",
 
Both images will complete the 'npm i' and install the chrome driver providing the driver version is 79 or lower.

Any help would be gratefully received as I think I've exhausted everything I can think of and this is a potential showstopper for us to continue using Nightwatch if we can't test the latest.
FYI for security reasons pulling a third-party image from docker-hub would not be allowed.

Thanks 
Brian

Jenkins output from the build pipeline
09:55:21  + npm i
09:55:29  
09:55:29  > chromedriver@80.0.2 install /home/jenkins/workspace/watch-signin_NT-312_docker_image/node_modules/chromedriver
09:55:29  > node install.js
09:55:29  
09:55:29  internal/util.js:209
09:55:29      throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function');
09:55:29      ^
09:55:29  
09:55:29  TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
09:55:29      at promisify (internal/util.js:209:11)
09:55:29      at Object.<anonymous> (/home/jenkins/workspace/watch-signin_NT-312_docker_image/node_modules/extract-zip/index.js:11:18)
09:55:29      at Module._compile (module.js:652:30)
09:55:29      at Object.Module._extensions..js (module.js:663:10)
09:55:29      at Module.load (module.js:565:32)
09:55:29      at tryModuleLoad (module.js:505:12)
09:55:29      at Function.Module._load (module.js:497:3)
09:55:29      at Module.require (module.js:596:17)
09:55:29      at require (internal/module.js:11:18)
09:55:29      at Object.<anonymous> (/home/jenkins/workspace/watch-signin_NT-312_docker_image/node_modules/chromedriver/install.js:14:20)
09:55:29  npm WARN eslint-plugin-prettier@3.0.1 requires a peer of prettier@>= 1.13.0 but none is installed. You must install peer dependencies yourself.
09:55:29  npm WARN nightwatch-signin@0.1.0 No repository field.
09:55:29  
09:55:29  npm ERR! code ELIFECYCLE
09:55:29  npm ERR! errno 1
09:55:29  npm ERR! chromedriver@80.0.2 install: `node install.js`
09:55:29  npm ERR! Exit status 1
09:55:29  npm ERR!
09:55:29  npm ERR! Failed at the chromedriver@80.0.2 install script.
09:55:29  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
09:55:29  
09:55:29  npm ERR! A complete log of this run can be found in:
09:55:29  npm ERR!     /home/jenkins/.npm/_logs/2020-06-29T08_55_29_853Z-debug.log
Post stage
[Pipeline] echo
09:55:30  Failure


Dockerfile build by Jenkins 
echo "FROM ubuntu:18.04

RUN apt update -y

RUN apt-get install -y npm nodejs curl wget jq git unzip zip maven default-jdk firefox libpython-dev python-dev python-pip

RUN export PATH=/usr/local/bin:/usr/bin:$PATH

RUN npm install -g n n...@6.4.1 --unsafe-perm


RUN echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list.d/google-chrome.list

RUN apt-get update

RUN apt-get -y install google-chrome-stable

RUN pip install awscli

# RUN npm install -g n n...@6.4.1 --unsafe-perm
RUN npm install -g npm@latest

RUN mkdir /root/.ssh

RUN ln -s /run/secrets/host_ssh_key /root/.ssh/id_rsa

RUN touch /root/.ssh/known_hosts

RUN groupadd --gid 1001 jenkins && useradd -G jenkins -m -N --uid 1001 jenkins

USER jenkins

" > Dockerfile



Andrei Rusu

unread,
Jun 29, 2020, 3:16:58 PM6/29/20
to NightwatchJs
This seems more of a problem with the chromedriver package. So you have a few options:
- raise an issue on their github repo
- skip downloading the chromedriver during the npm install and instead download it manually and specify the path to the binary (check the chromedriver page for options)

You haven't specified if Chrome is running file in the container and also how are you running chrome, since there's no Xvfb in the container.

We also have this Chrome + chromedriver + Xbfb dockerfile, maybe you'll find it useful: https://github.com/pineviewlabs/docker-chromedriver

Chris Jackson

unread,
Jul 2, 2020, 4:52:44 PM7/2/20
to NightwatchJs
Have you tried setting the following environment variable?

export DETECT_CHROMEDRIVER_VERSION=true

This will check what version of Chrome is installed and npm install the appropriate chromedriver. 

Juliet

unread,
Jul 21, 2020, 7:31:41 AM7/21/20
to NightwatchJs
I had an issue with Chrome docking stations and this worked.   Add the


HI,  Try this.   I had this problem before with Chrome docking stations and this help.   Add --no-sandbox to args in the nightwatch config. 


      "desiredCapabilities": {
          "browserName": "chrome",
          "javascriptEnabled": true,
          "acceptSslCerts": true,
            "chromeOptions": {
              "args": ["--no-sandbox "

              
                ],
Reply all
Reply to author
Forward
0 new messages