NPM“418我是茶壶"怎么解决尝试使用 npm install 时出错? [英] How do I solve the NPM "418 I'm a teapot" error when trying to use npm install?

查看:88
本文介绍了NPM“418我是茶壶"怎么解决尝试使用 npm install 时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用以下命令在具有公司代理的服务器上安装 Yeoman 和 Gulp:

I've been trying to install Yeoman and Gulp on a server that has a corporate proxy using the following command:

npm install -g yo gulp

但是,当我运行此命令(或任何npm install"命令)时,我遇到了:

However when I run this comand (or any "npm install" command) I get hit with:

npm ERR!       E418
npm ERR! 418 I'm a teapot: gulp@latest

我非常确信这是一个与代理有关的问题,但我无法弄清楚究竟是什么原因造成的.

I'm pretty confident that this is an issue pertaining to the proxy but I can't figure out what exactly is causing it.

我做过的一些测试:

  • 我将代理添加到我的 npmrc 文件中,其中包含用于身份验证的登录信息,我相信它已正确输入.如果我更改用户名或密码的任何部分,我的错误将更改为 E407(身份验证失败).

  • I added the proxy to my npmrc file with login information for authentication and I believe it's entered properly. If I change any part of the username or password my error changes to an E407 (authentication failed).

我运行了npm config set strict-ssl false",但似乎没有任何作用.

I ran "npm config set strict-ssl false" and that seemed to not do anything.

我尝试运行不同的安装,但我仍然得到418 我是一个茶壶 package@latest".

I tried running different installs and I still just get "418 I'm a teapot package@latest".

推荐答案

所以经过几个小时的论坛和博客挖掘后,解决方案是将我的注册表从http://registry.npmjs.org/" 到 "https://registry.npmjs.org/".

So after a few more hours of digging through forums and blogs the solution was to change my registry from "http://registry.npmjs.org/" to "https://registry.npmjs.org/".

显然,在某些代理上,注册表将重定向到该地址,但如果尝试在没有 https 的情况下进行连接,则会将端口 443 添加到该地址.

Apparently when on some proxies the registry will redirect to the address but add port 443 to the address if trying to connect without the https.

希望这对遇到此问题的其他人有所帮助!

Hope this helps anyone else experiencing this issue!

这篇关于NPM“418我是茶壶"怎么解决尝试使用 npm install 时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆