0

I'm trying to install chromedriver based on instructions here https://www.selenium.dev/selenium-ide/docs/en/introduction/command-line-runner

First I installed:

sudo apt install nodejs # installs npm too
sudo npm install -g selenium-side-runner

but I get the following error when it comes to installation of the chromedriver:

$ sudo npm install -g chromedriver
/usr/bin/chromedriver -> /usr/lib/node_modules/chromedriver/bin/chromedriver

> chromedriver@87.0.0 install /usr/lib/node_modules/chromedriver
> node install.js

ChromeDriver binary exists. Validating...
ChromeDriver is already available at '/tmp/87.0.4280.20/chromedriver/chromedriver'.
Copying to target path /usr/lib/node_modules/chromedriver/lib/chromedriver
ChromeDriver installation failed Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/chromedriver/lib/chromedriver'
    at Object.mkdirSync (fs.js:921:3)
    at copyIntoPlace (/usr/lib/node_modules/chromedriver/install.js:302:6)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async install (/usr/lib/node_modules/chromedriver/install.js:64:5) {
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: '/usr/lib/node_modules/chromedriver/lib/chromedriver'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chromedriver@87.0.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the chromedriver@87.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/den/.npm/_logs/2020-11-19T16_00_19_093Z-debug.log

How can the permission be denied if I run the command as super user? I don't understand the error output.

Here is end of the debug.log:

...
2041 info lifecycle tcp-port-used@1.0.1~install: tcp-port-used@1.0.1
2042 silly install chromedriver@87.0.0
2043 info lifecycle chromedriver@87.0.0~install: chromedriver@87.0.0
2044 verbose lifecycle chromedriver@87.0.0~install: unsafe-perm in lifecycle false
2045 verbose lifecycle chromedriver@87.0.0~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/lib/node_modules/chromedriver/node_modules/.bin:/usr/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
2046 verbose lifecycle chromedriver@87.0.0~install: CWD: /usr/lib/node_modules/chromedriver
2047 silly lifecycle chromedriver@87.0.0~install: Args: [ '-c', 'node install.js' ]
2048 silly lifecycle chromedriver@87.0.0~install: Returned: code: 1  signal: null
2049 info lifecycle chromedriver@87.0.0~install: Failed to exec install script
2050 timing action:install Completed in 1630ms
2051 verbose unlock done using /home/den/.npm/_locks/staging-a072192f34a17023.lock for /usr/lib/node_modules/.staging
2052 timing stage:rollbackFailedOptional Completed in 54ms
2053 timing stage:runTopLevelLifecycles Completed in 3898ms
2054 verbose stack Error: chromedriver@87.0.0 install: `node install.js`
2054 verbose stack Exit status 1
2054 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
2054 verbose stack     at EventEmitter.emit (events.js:314:20)
2054 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
2054 verbose stack     at ChildProcess.emit (events.js:314:20)
2054 verbose stack     at maybeClose (internal/child_process.js:1021:16)
2054 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
2055 verbose pkgid chromedriver@87.0.0
2056 verbose cwd /media/wd/job/otr/apmv
2057 verbose Linux 5.4.0-54-generic
2058 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "chromedriver"
2059 verbose node v12.19.1
2060 verbose npm  v6.14.8
2061 error code ELIFECYCLE
2062 error errno 1
2063 error chromedriver@87.0.0 install: `node install.js`
2063 error Exit status 1
2064 error Failed at the chromedriver@87.0.0 install script.
2064 error This is probably not a problem with npm. There is likely additional logging output above.
2065 verbose exit [ 1, true ]
ka3ak
  • 2,435
  • 2
  • 30
  • 57

1 Answers1

0

The following command did the trick:

sudo npm install --unsafe-perm -g chromedriver

I've found the solution here https://stackoverflow.com/a/54609831/971355

Thanks to @tripleee

ka3ak
  • 2,435
  • 2
  • 30
  • 57