npm / registry-issue-archive

An archive of the old npm registry issue tracker
https://npm.community
249 stars 47 forks source link

npm install - returns HTTP 418 #335

Closed mcgrews3 closed 6 years ago

mcgrews3 commented 6 years ago

We use a proxy to connect to the NPM registry - when using npm install all packages are returning HTTP 418 on the proxy and the npm client is returning not found.

mcgrews3 commented 6 years ago

Example: OUT - [2018-05-28T23:20:28.183+0000] "GET /tweetnacl HTTP/1.1" 404 0 19 "install" "npm/3.10.10 node/v6.10.2 win32 x64"

Thought I saw an HTTP Status code of 418 in there too, but cant find it in the logs.

mcgrews3 commented 6 years ago

I believe our proxy is getting an HTTP 418 - and is just turning it into an HTTP 404.

What is HTTP 418 Teapot used for?

TomLingham commented 6 years ago

Related https://github.com/npm/npm/issues/20791

wgrant commented 6 years ago

The body of the 418 is {"error":"got unknown host (registry.npmjs.org:443)"}. Looks like some npm clients are appending the port to the Host header, but only when going through a proxy, and that's confusing the registry:

$ wget --header='Host: registry.npmjs.org:443' https://registry.npmjs.org/
--2018-05-29 01:22:08--  https://registry.npmjs.org/
Resolving registry.npmjs.org (registry.npmjs.org)... 104.18.95.96, 104.18.97.96, 104.18.94.96, ...
Connecting to registry.npmjs.org (registry.npmjs.org)|104.18.95.96|:443... connected.
HTTP request sent, awaiting response... 418 I'm a teapot
2018-05-29 01:22:08 ERROR 418: I'm a teapot.

It's perfectly legal for the Host header to include the default port, so the registry is in the wrong here.

brandonpittman commented 6 years ago

Would it kill them to give a helpful error instead of making a joke? Wasted a good chunk of the the morning reading posts about April Fool's jokes and memes from 1998 when I just wanted to know how to fix the problem.

youngtae-samsung commented 6 years ago

looks like solved....

mcgrews3 commented 6 years ago

Working now.

Nimisoere commented 6 years ago

Still not working. Not fixed. Using yarn seems like the best option.

nabanita- commented 6 years ago

Still facing this issue :/

predzme commented 6 years ago

same here, facing the issue right now.

veeramanx commented 6 years ago

still facing the issue since morning.

Nimisoere commented 6 years ago

And now it works. 👍

predzme commented 6 years ago

Still not working for me :/

SOLVED : I solved the problem by editing the registry to https : npm config set registry https://registry.npmjs.org/

PavanaRVaidya commented 6 years ago

npm config set registry https://registry.npmjs.org/ solved the issue.. Thank you @predzme

reshmamarla commented 6 years ago

@predzme npm config set registry solved the issue for me