TSD error: self signed certificate in certificate chain
Asked Answered
F

2

6

I am following the Angular 2 quick start guide and I'm stuck right at the beginning of it.

My company is filtering our network connections and modifying SSL negociation. In a man in the middle style they assign a self signed certificate as the CA of the destination's certificate.

Therefore when I execute the second command

npm install -g tsd
tsd query angular2 --action install

I get this:

stream.js:75
      throw er; // Unhandled stream error in pipe.
            ^
Error: self signed certificate in certificate chain
    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:908:38)
    at emitNone (events.js:67:13)
    at TLSSocket.emit (events.js:163:7)
    at TLSSocket._finishInit (_tls_wrap.js:496:8)

Does anybody know a way of disabling the self signed certificate verification?

Fritillary answered 22/6, 2015 at 15:41 Comment(0)
P
5

One little FYI first : if you just want to learn AngularJS, maybe it's not the best way to start with TypeScript. If it's the case for you, try the tutorial on angularjs.org, which use JavaScript and angular-seed.

Anyway, if you want to use tsd, you have to edit your tsdrc file (in your user's home directory), to set the proxy, and maybe, to turn of strictSSL. See https://github.com/DefinitelyTyped/tsd#tsdrc

Following this documentation, this is what you certainly need to add to your tsdrc file :

{
    "proxy": "http://proxy.example.com:88",
    "strictSSL" : false
}

Edit : I also don't think it's an npm problem. So please update your question.

Palmer answered 22/6, 2015 at 17:18 Comment(4)
And if you have others problems, with npm this time, see #7560148Palmer
Hi nonox, thanks for your support. With the tsdrc file config it worked like a charm.Fritillary
Great :) Now, you just have to change the title of the question from "NPM Error" to "TSD error". thxPalmer
Just mentioning in case someone faces similar problem like me. I was running into this error -->>> error An unexpected error occurred: "https://registry.yarnpkg.com/@angular%2fcompiler: self signed certificate in certificate chain". So just added a .tsdrc file to my angular2-project and put in { "strictSSL" : false } and then ran "yarn" and it worked.Yuu
S
5

For yarn a very similar error occurs:

error An unexpected error occurred:
"https://registry.yarnpkg.com/generator-jhipster: self signed
certificate in certificate chain".

after

export NODE_TLS_REJECT_UNAUTHORIZED=0

I get:

error An unexpected error occurred: "https://registry.yarnpkg.com/generator-jhipster: SSL Error: SELF_SIGNED_CERT_IN_CHAIN".

Finally the solution, with the below yarn is now happy to accept the man in the middle attack by my corporate proxy.

export NODE_TLS_REJECT_UNAUTHORIZED=0
yarn config set strict-ssl false --global
Spectre answered 7/6, 2017 at 4:44 Comment(1)
Thanks, this saved my day. I had the same issue to use "create-react-app", got the same error "SSL Error: SELF_SIGNED_CERT_IN_CHAIN".. Google brought me to this SO question and your "yarn config set strict-ssl false --global" saved my day.Carruth

© 2022 - 2024 — McMap. All rights reserved.