Search code examples
node.jsnpmnode-modulesgeckodriver

installing geckodriver gives me an issue during npm install


I am facing an error while installing geckodriver. I removed node_modules, cleared cache, removed lock files, and still nothing works.'

When I remove geckodriver from package.json npm install just works fine.

Below is the error log

[email protected] postinstall /Users/username/buildAndReleaseTask/node_modules/geckodriver
> node index.js

Downloading geckodriver... 
events.js:292
      throw er; // Unhandled 'error' event
      ^
ErrorClass [RequestError]: self signed certificate in certificate chain
    at ClientRequest.<anonymous> (/buildAndReleaseTask/node_modules/got/index.js:69:21)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at TLSSocket.socketErrorListener (_http_client.js:469:9)
    at TLSSocket.emit (events.js:315:20)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on DuplexWrapper instance at:
    at EventEmitter.emit (events.js:315:20)
    at ClientRequest.<anonymous> (/buildAndReleaseTask/node_modules/got/index.js:69:7)
    at Object.onceWrapper (events.js:422:26)
    [... lines matching original stack trace ...]
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'SELF_SIGNED_CERT_IN_CHAIN',
  host: 'github.com',
  hostname: 'github.com',
  method: 'GET',
  path: '/mozilla/geckodriver/releases/download/v0.29.0/geckodriver-v0.29.0-macos.tar.gz'
}
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Solution

  • I was able to resolve the npm install for geckodriver by executing the below commands in the same order.

    npm config set strict-ssl false
    export NODE_TLS_REJECT_UNAUTHORIZED=0