Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stack "Error: self signed certificate in certificate chain" when trying to build 'node-gyp configure'

I got below error when trying to build the microsoft driver for nodejs for sql server

gyp info it worked if it ends with ok

gyp info using [email protected]

gyp info using [email protected] | win32 | x64

gyp http GET https://nodejs.org/download/release/v5.3.0/node-v5.3.0-headers.tar.gz

gyp WARN install got an error, rolling back install

gyp ERR! configure error

gyp ERR! stack Error: self signed certificate in certificate chain

gyp ERR! stack at Error (native)

gyp ERR! stack at TLSSocket. (_tls_wrap.js:1057:38)

gyp ERR! stack at emitNone (events.js:67:13)

gyp ERR! stack at TLSSocket.emit (events.js:166:7)

gyp ERR! stack at TLSSocket._finienter code hereshInit

gyp ERR! not ok "

i tried with below workaround but it dint work

1) upgrade your version of npm

npm install npm -g --ca=null

- or -

2) tell your current version of npm to use known registrars  

npm config set ca=""

Can anyone guide me how to resolve this certificate issue

like image 439
Dilip Reddy Avatar asked Jan 05 '16 10:01

Dilip Reddy


1 Answers

Came across the same problem when node-gyp starts compiling node.js addons source. And as @mujimu suggested, fixed it setting a shell variable NODE_TLS_REJECT_UNAUTHORIZED value to 0 before executing npm install, as follows:

$ set NODE_TLS_REJECT_UNAUTHORIZED=0
$ npm install
like image 127
Arpit Aggarwal Avatar answered Sep 17 '22 10:09

Arpit Aggarwal