serenity-js / serenity-js

A next generation, full-stack acceptance testing framework optimised for collaboration, speed and scale!
https://serenity-js.org
Apache License 2.0
554 stars 160 forks source link

Error: unable to get local issuer certificate #19

Closed mrj04 closed 7 years ago

mrj04 commented 7 years ago

Hi Jan, I am trying to run examples in serenity-js i get the below error .

$npm test

serenity-protractor-cucumber@1.0.0 pretest /Users/$user/Downloads/serenity-js-master/examples/todomvc-protractor-cucumber serenity update

info: Looks like you need the latest Serenity BDD CLI jar. Let me download it for you... events.js:160 throw er; // Unhandled 'error' event ^

Error: unable to get local issuer certificate at Error (native) at TLSSocket. (_tls_wrap.js:1079:38) at emitNone (events.js:86:13) at TLSSocket.emit (events.js:185:7) at TLSSocket._finishInit (_tls_wrap.js:603:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:433:38) npm ERR! Test failed. See above for more details.

Thanks RJ

jan-molak commented 7 years ago

Hey @mrj04! If you happen to be behind a corporate proxy, your might need to configure your node.js with the local certificate your company is using (this thread provides more information).

To set the cafile:

npm config set cafile=/path/to/your/file.pem

The contents of the .pem file content would be similar to this (plain text with BEGIN/END certificate marks and the base64 content).

To generate the .pem file from a valid .crt file you can use openssl:

openssl x509 -inform der -in /path/to/the.crt -out /path/to/your/file.pem

Hope that helps!

Jan