NPM Certificate issue

Hi,

I have problem installing packages with npm. I get server error 500 when ever trying to install webpack.
I am installing packages on Ubuntu instance running on OpenStack cloud server. Here is a log file of latest failed install attempt:
> 0 info it worked if it ends with ok

1 verbose cli [ ‘/usr/bin/node’, ‘/usr/bin/npm’, ‘install’, ‘webpack’ ]
2 info using npm@6.11.3
3 info using node@v10.17.0
4 verbose npm-session 9f7964318b47fa59
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 500 https://registry_npmjs_org/webpack 72190ms attempt #3
8 silly fetchPackageMetaData error for webpack@latest 500 Internal Server Error - GET https://registry_npmjs_org/webpack
9 timing stage:rollbackFailedOptional Completed in 0ms
10 timing stage:runTopLevelLifecycles Completed in 72380ms
11 verbose stack Error: 500 Internal Server Error - GET https://registry_npmjs_org/webpack
11 verbose stack at res_buffer_catch_then_body (/usr/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:104:15)
11 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose statusCode 500
13 verbose pkgid webpack@latest
14 verbose cwd /home/ubuntu/WebODM
15 verbose Linux 4.4.0-166-generic
16 verbose argv “/usr/bin/node” “/usr/bin/npm” “install” “webpack”
17 verbose node v10.17.0
18 verbose npm v6.11.3
19 error code E500
20 error 500 Internal Server Error - GET https://registry_npmjs_org/webpack
21 verbose exit [ 1, true ]

If I try to get index file on “reqistry.npmjs.org” with curl I get:

“curl https://registry_npmjs_org/”
curl: (51) SSL: certificate subject name (a.sni.fastly.net) does not match target host name ‘registry.npmjs.org
Accessing that page with my local browser works fine npm error would indicate that server experience some error, but curl would indicate that it is an certificate issue.
If I change registry address to http instead of https I get this error with curl:

<html>
<head>
<title>Fastly error: unknown domain</title>
</head>
<body>
Fastly error: unknown domain. Please check that this domain has been added to a service.
</body>
</html>

I have tried to set strict-ssl option to False but no effect.
Any help how to debug this further would be greatly appreciated. (note I had to mask URL to avoid 5 link limitation for new users)

I am not sure why fastly is in there, whether that is something in your setup or a CDN that npm is using.

Are you using a proxy?

Good question why the Fastly is there, I was installing WebODM while I ran into this problem so it might come from somewhere there. There should not be any proxy settings at least based on env and /etc/environment…
OpenStack is running on server that is located in Brazil, but that should not have anything to do with it.

Ok I got it figured out.
For some reason someone/something had put static IP mapping of name registry.npmjs.com into /etc/hosts. I commented out it and everything started working. I got suspicious after curl fetch with IP address worked just fine. (curl -k --header ‘Host: registry.npmjs.com’ 104.16.17.35/webpack)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.