16
votes

I'm was looking at the Angular2 tutorial on: https://github.com/angular/quickstart/blob/master/README.md

However, when I run the npm install as per the guide, i initially got an error related to UNABLE_TO_VERIFY_LEAF_SIGNATURE. Which on googling seemed related to SSL cert so I then attempted to just get around this by using the following command:

npm config set strict-ssl false

I then retried npm install

This got a bit further but then got new errors related to "unable to verify the first certificate":

typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/core-js/tags/0.0.0%2B20160725163759"
typings ERR! caused by unable to verify the first certificate

typings ERR! cwd c:\Code\Angular2\Quickstart
typings ERR! system Windows_NT 6.1.7601
typings ERR! command "C:\\Program Files\\nodejs\\node.exe" "c:\\Code\\Angular2\\Quickstart\\node_modules\\typings\\dist\\bin.js" "install"
typings ERR! node -v v6.7.0
typings ERR! typings -v 1.4.0
typings ERR! code EUNAVAILABLE

typings ERR! If you need help, you may report this error at:
typings ERR!   <https://github.com/typings/typings/issues>

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     c:\Code\Angular2\Quickstart\npm-debug.log

I'm new to NodeJS and Angular2 development. Any ideas ? If I have missed out any detail then let me know.

4
If you google npm EUNAVAILABLE you get a lot of errors with typings. You could try installing typings manually. e.g. npm install typings -g --msvs-version=2015 which just worked for me.leetibbett
p.s. i'm still on node 4.2.3leetibbett
@leetibbett I tried that suggestion then re-ran the same npm install command but stil got the same errorRubans
So the manual global install of typings worked or failed?leetibbett
If you download the autoconfig script with your web browser and look at it, it should contain the proxy name. From there you can configure it into npm with npm config set proxy=http://<proxy>:<port>. You might also need to configure git which I think is like git configure --add http.proxy http://<proxy>:<port>leetibbett

4 Answers

14
votes

You can try change the registry to the http version in config

npm config set registry http://registry.npmjs.org/ --global
5
votes

In my case adding the ca-file in .npmrc to the corporate proxy certificate was the solution:

npm config set cafile "path to proxy cert file"

or insert with editor in .npmrc:

cafile=<path to proxy cert file>

The .npmrc file is located in the home directory.

1
votes

I was able to resolve the issue by using the instructions here: https://github.com/typings/typings/issues/564

The issue is ultimately related to my machine being behind some corporate proxy which seems to be related to npm unable to authenticate https against the proxy. Since I didn't have any further information about the proxy being used so was unable to configure as per @leetibbett suggestion above. So I created .typingsrc file in the root directory to use http version:

{
     "rejectUnauthorized": false,
     "registryURL": "http://api.typings.org/"
}
0
votes

I uninstalled the node Js 12 and reinstalled the version 10. That solved my problem. I am not sure if the problem was the version, but you can try. I hope that has helped you.