Search code examples
node.jsnpmazure-devopse2e-testingnightwatch.js

AzureDevOps pipeline - Nightwatch selenium standalone installation issue - Unable to run npm run 'e2e-setup' (contains 'selenium-standalone install')


I am trying to setup selenium standalone server with various browsers the script works fine on my local machine but same has issues working on Azure cloud using Azure DevOps tool.

From the logs (Detailed logs at the end) I see the below but not sure how to fix it:

2020-04-17T21:39:25.3581171Z Usage: selenium-standalone action [options]
2020-04-17T21:39:25.3581533Z 
2020-04-17T21:39:25.3582171Z npm ERR! Linux 5.0.0-1031-azure
2020-04-17T21:39:25.3582843Z npm ERR! argv "/vsts/agent/_work/_tool/node/6.17.1/x64/bin/node" "/vsts/agent/_work/_tool/node/6.17.1/x64/bin/npm" "run" "e2e-setup"
2020-04-17T21:39:25.3583217Z npm ERR! node v6.17.1
2020-04-17T21:39:25.3583400Z npm ERR! npm  v3.10.10
2020-04-17T21:39:25.3583580Z npm ERR! code ELIFECYCLE
2020-04-17T21:39:25.3584038Z npm ERR! [email protected] e2e-setup: `selenium-standalone install`
2020-04-17T21:39:25.3584332Z npm ERR! Exit status 255

I have the below package.json:

{
  "name": "temp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "nightwatch",
    "e2e-setup": "selenium-standalone install"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.9.0",
    "@babel/preset-env": "^7.9.0",
    "babel-core": "^6.26.3",
    "babel-plugin-add-module-exports": "^1.0.2",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.24.1",
    "gulp-babel": "^8.0.0-beta.2",
    "selenium-standalone": "^6.17.0"
  },
  "dependencies": {
    "easy-soap-request": "^3.2.2",
    "nightwatch": "^1.3.4",
    "xmldom": "^0.3.0"
  }
}

on VScode when I run npm install nightwatch npm install selenium-standalone and npm run e2e-setup

I do not have any issues when I try the above on my machine - Selenium server jar and all the browser (chrome, firefox, ie, edge) binaries are getting downloaded)

The above setup is as mentioned in the official seleinum-standalone npm website (https://www.npmjs.com/package/selenium-standalone#install--run)

My Azure CI setup:

enter image description here

But when I try the same on Azure DevOps tool (Running the same on Azure cloud) I am having issues like below:

2020-04-17T21:39:22.1913471Z ##[section]Starting: npm run e2e-setup
2020-04-17T21:39:22.1923363Z ==============================================================================
2020-04-17T21:39:22.1923659Z Task         : npm
2020-04-17T21:39:22.1924046Z Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
2020-04-17T21:39:22.1924428Z Version      : 1.166.1
2020-04-17T21:39:22.1924652Z Author       : Microsoft Corporation
2020-04-17T21:39:22.1924983Z Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/package/npm
2020-04-17T21:39:22.1925348Z ==============================================================================
2020-04-17T21:39:22.5235427Z SYSTEMVSSCONNECTION exists true
2020-04-17T21:39:22.7105531Z SYSTEMVSSCONNECTION exists true
2020-04-17T21:39:22.7890296Z [command]/vsts/agent/_work/_tool/node/6.17.1/x64/bin/npm --version
2020-04-17T21:39:23.0268360Z 3.10.10
2020-04-17T21:39:23.9587311Z [command]/vsts/agent/_work/_tool/node/6.17.1/x64/bin/npm config list
2020-04-17T21:39:24.4295571Z ; cli configs
2020-04-17T21:39:24.4297644Z user-agent = "npm/3.10.10 node/v6.17.1 linux x64"
2020-04-17T21:39:24.4298039Z 
2020-04-17T21:39:24.4298357Z ; environment configs
2020-04-17T21:39:24.4298785Z userconfig = "/vsts/agent/_work/_temp/npm/830.npmrc"
2020-04-17T21:39:24.4299106Z 
2020-04-17T21:39:24.4299481Z ; node bin location = /vsts/agent/_work/_tool/node/6.17.1/x64/bin/node
2020-04-17T21:39:24.4300000Z ; cwd = /vsts/agent/_work/r2/a/_QA_IDLookUp
2020-04-17T21:39:24.4300385Z ; HOME = /root
2020-04-17T21:39:24.4301230Z ; "npm config ls -l" to show all defaults.
2020-04-17T21:39:24.4301526Z 
2020-04-17T21:39:24.4304850Z [command]/vsts/agent/_work/_tool/node/6.17.1/x64/bin/npm run e2e-setup
2020-04-17T21:39:25.3579514Z not found: java
2020-04-17T21:39:25.3579860Z 
2020-04-17T21:39:25.3581171Z Usage: selenium-standalone action [options]
2020-04-17T21:39:25.3581533Z 
2020-04-17T21:39:25.3582171Z npm ERR! Linux 5.0.0-1031-azure
2020-04-17T21:39:25.3582843Z npm ERR! argv "/vsts/agent/_work/_tool/node/6.17.1/x64/bin/node" "/vsts/agent/_work/_tool/node/6.17.1/x64/bin/npm" "run" "e2e-setup"
2020-04-17T21:39:25.3583217Z npm ERR! node v6.17.1
2020-04-17T21:39:25.3583400Z npm ERR! npm  v3.10.10
2020-04-17T21:39:25.3583580Z npm ERR! code ELIFECYCLE
2020-04-17T21:39:25.3584038Z npm ERR! [email protected] e2e-setup: `selenium-standalone install`
2020-04-17T21:39:25.3584332Z npm ERR! Exit status 255
2020-04-17T21:39:25.3584511Z npm ERR! 
2020-04-17T21:39:25.3584965Z npm ERR! Failed at the [email protected] e2e-setup script 'selenium-standalone install'.
2020-04-17T21:39:25.3585333Z npm ERR! Make sure you have the latest version of node.js and npm installed.
2020-04-17T21:39:25.3585684Z npm ERR! If you do, this is most likely a problem with the temp package,
2020-04-17T21:39:25.3585947Z npm ERR! not with npm itself.
2020-04-17T21:39:25.3586231Z npm ERR! Tell the author that this fails on your system:
2020-04-17T21:39:25.3586678Z npm ERR!     selenium-standalone install
2020-04-17T21:39:25.3587020Z npm ERR! You can get information on how to open an issue for this project with:
2020-04-17T21:39:25.3587342Z npm ERR!     npm bugs temp
2020-04-17T21:39:25.3587803Z npm ERR! Or if that isn't available, you can get their info via:
2020-04-17T21:39:25.3588109Z npm ERR!     npm owner ls temp
2020-04-17T21:39:25.3588351Z npm ERR! There is likely additional logging output above.
2020-04-17T21:39:25.3588530Z 
2020-04-17T21:39:25.3588791Z npm ERR! Please include the following file with any support request:
2020-04-17T21:39:25.3589311Z npm ERR!     /vsts/agent/_work/r2/a/_QA_IDLookUp/npm-debug.log
2020-04-17T21:39:25.3590596Z > [email protected] e2e-setup /vsts/agent/_work/r2/a/_QA_IDLookUp
2020-04-17T21:39:25.3591763Z > selenium-standalone install
2020-04-17T21:39:25.3592087Z 
2020-04-17T21:39:25.3734932Z Found npm debug log, make sure the path matches with the one in npm's output: /vsts/agent/_work/r2/a/_QA_IDLookUp/npm-debug.log
2020-04-17T21:39:25.3735698Z 0 info it worked if it ends with ok
2020-04-17T21:39:25.3737184Z 1 verbose cli [ '/vsts/agent/_work/_tool/node/6.17.1/x64/bin/node',
2020-04-17T21:39:25.3738213Z 1 verbose cli   '/vsts/agent/_work/_tool/node/6.17.1/x64/bin/npm',
2020-04-17T21:39:25.3739010Z 1 verbose cli   'run',
2020-04-17T21:39:25.3739677Z 1 verbose cli   'e2e-setup' ]
2020-04-17T21:39:25.3740072Z 2 info using [email protected]
2020-04-17T21:39:25.3740401Z 3 info using [email protected]
2020-04-17T21:39:25.3741309Z 4 verbose run-script [ 'pree2e-setup', 'e2e-setup', 'poste2e-setup' ]
2020-04-17T21:39:25.3742292Z 5 info lifecycle [email protected]~pree2e-setup: [email protected]
2020-04-17T21:39:25.3743416Z 6 silly lifecycle [email protected]~pree2e-setup: no script for pree2e-setup, continuing
2020-04-17T21:39:25.3744395Z 7 info lifecycle [email protected]~e2e-setup: [email protected]
2020-04-17T21:39:25.3745399Z 8 verbose lifecycle [email protected]~e2e-setup: unsafe-perm in lifecycle true
2020-04-17T21:39:25.3747409Z 9 verbose lifecycle [email protected]~e2e-setup: PATH: /vsts/agent/_work/_tool/node/6.17.1/x64/lib/node_modules/npm/bin/node-gyp-bin:/vsts/agent/_work/r2/a/_QA_IDLookUp/node_modules/.bin:/vsts/agent/_work/_tool/node/6.17.1/x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2020-04-17T21:39:25.3749200Z 10 verbose lifecycle [email protected]~e2e-setup: CWD: /vsts/agent/_work/r2/a/_QA_IDLookUp
2020-04-17T21:39:25.3750457Z 11 silly lifecycle [email protected]~e2e-setup: Args: [ '-c', 'selenium-standalone install' ]
2020-04-17T21:39:25.3751608Z 12 silly lifecycle [email protected]~e2e-setup: Returned: code: 255  signal: null
2020-04-17T21:39:25.3752743Z 13 info lifecycle [email protected]~e2e-setup: Failed to exec e2e-setup script
2020-04-17T21:39:25.3753814Z 14 verbose stack Error: [email protected] e2e-setup: `selenium-standalone install`
2020-04-17T21:39:25.3754348Z 14 verbose stack Exit status 255
2020-04-17T21:39:25.3755003Z 14 verbose stack     at EventEmitter.<anonymous> (/vsts/agent/_work/_tool/node/6.17.1/x64/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
2020-04-17T21:39:25.3755744Z 14 verbose stack     at emitTwo (events.js:106:13)
2020-04-17T21:39:25.3756353Z 14 verbose stack     at EventEmitter.emit (events.js:191:7)
2020-04-17T21:39:25.3757140Z 14 verbose stack     at ChildProcess.<anonymous> (/vsts/agent/_work/_tool/node/6.17.1/x64/lib/node_modules/npm/lib/utils/spawn.js:40:14)
2020-04-17T21:39:25.3757834Z 14 verbose stack     at emitTwo (events.js:106:13)
2020-04-17T21:39:25.3758420Z 14 verbose stack     at ChildProcess.emit (events.js:191:7)
2020-04-17T21:39:25.3759038Z 14 verbose stack     at maybeClose (internal/child_process.js:920:16)
2020-04-17T21:39:25.3759714Z 14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
2020-04-17T21:39:25.3760203Z 15 verbose pkgid [email protected]
2020-04-17T21:39:25.3760616Z 16 verbose cwd /vsts/agent/_work/r2/a/_QA_IDLookUp
2020-04-17T21:39:25.3761457Z 17 error Linux 5.0.0-1031-azure
2020-04-17T21:39:25.3762546Z 18 error argv "/vsts/agent/_work/_tool/node/6.17.1/x64/bin/node" "/vsts/agent/_work/_tool/node/6.17.1/x64/bin/npm" "run" "e2e-setup"
2020-04-17T21:39:25.3763170Z 19 error node v6.17.1
2020-04-17T21:39:25.3763496Z 20 error npm  v3.10.10
2020-04-17T21:39:25.3763826Z 21 error code ELIFECYCLE
2020-04-17T21:39:25.3764642Z 22 error [email protected] e2e-setup: `selenium-standalone install`
2020-04-17T21:39:25.3765087Z 22 error Exit status 255
2020-04-17T21:39:25.3765921Z 23 error Failed at the [email protected] e2e-setup script 'selenium-standalone install'.
2020-04-17T21:39:25.3766518Z 23 error Make sure you have the latest version of node.js and npm installed.
2020-04-17T21:39:25.3767106Z 23 error If you do, this is most likely a problem with the temp package,
2020-04-17T21:39:25.3767909Z 23 error not with npm itself.
2020-04-17T21:39:25.3768396Z 23 error Tell the author that this fails on your system:
2020-04-17T21:39:25.3769248Z 23 error     selenium-standalone install
2020-04-17T21:39:25.3769864Z 23 error You can get information on how to open an issue for this project with:
2020-04-17T21:39:25.3770358Z 23 error     npm bugs temp
2020-04-17T21:39:25.3771224Z 23 error Or if that isn't available, you can get their info via:
2020-04-17T21:39:25.3771966Z 23 error     npm owner ls temp
2020-04-17T21:39:25.3772352Z 23 error There is likely additional logging output above.
2020-04-17T21:39:25.3772813Z 24 verbose exit [ 1, true ]
2020-04-17T21:39:25.3773034Z 
2020-04-17T21:39:25.3775507Z ##[error]Error: Npm failed with return code: 1
2020-04-17T21:39:25.3816759Z ##[section]Finishing: npm run e2e-setup

Solution

  • The version of node and npm seem to be very old. I have been running nightwatch tests using selenium on travis, azure devops and github actions. My advice is to have the configuration through a yml file which is very simple. You can see mine in the below link and try it.

    Reference: https://github.com/spnraju/nightwatchjs-selenium-example/blob/master/azure-pipelines.yml