简体   繁体   English

npm 安装错误:ssh:连接到主机 github.com 端口 22:连接超时

[英]npm install error: ssh: connect to host github.com port 22: Connection timed out

I am trying to install gulp 4 in my project (Windows 7 machine).我正在尝试在我的项目(Windows 7 机器)中安装 gulp 4。 for that dependency, my package.json looks like:对于该依赖项,我的package.json如下所示:

"gulp": "gulpjs/gulp#4.0"

When I run npm install gulp I get this error:当我运行npm install gulp此错误:

npm ERR! ssh: connect to host github.com port 22: Connection timed out
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm verb exit [ 1, true ]

But when I try to clone a repository from GitHub it works fine,但是当我尝试从 GitHub 克隆存储库时,它工作正常,

git clone https://github.com/gulpjs/gulp.git

I am running these commands behind a corporate firewall.So I have my proxies set up in my environment variables.我在公司防火墙后面运行这些命令。所以我在我的环境变量中设置了我的代理。

http_proxy : http://proxy.company.com:port
https_proxy : https://proxy.company.com:port

I also tried setting:我也试过设置:

npm config set proxy http://proxy.company.com:8080

npm config set https-proxy http://proxy.company.com:8080

I tried the same in environment variables as well.我也在环境变量中尝试了同样的方法。

I also tried:我也试过:

npm config set proxy http://login:pass@proxy.company.com:port

npm config set https-proxy http://login:pass@proxy.company.com:port

None of the above seems to work.以上似乎都不起作用。 How can I fix this?我怎样才能解决这个问题?

I had the same problem.我有同样的问题。 Try this command and run npm install again.尝试此命令并再次运行 npm install。 This will change all of your urls to starting using https:// which seems to be working for you.这会将您的所有网址更改为开始使用 https://,这似乎对您有用。

git config --global url."https://".insteadOf git://

In my case there was a problem with proxy.就我而言,代理存在问题。 Somehow my proxy settings in global .gitconfig were broken, so I had to run the following commands:不知何故,我在全局.gitconfig中的代理设置被破坏了,所以我不得不运行以下命令:

git config --global http.proxy http://login:pass@proxy.url/ip.address:port
git config --global https.proxy http://login:pass@proxy.url/ip.address:port

Also check your npm config file, if u stuck with the same problem还要检查你的npm config文件,如果你npm config同样的问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ssh:连接到主机 github.com 端口 22:连接超时 - ssh: connect to host github.com port 22: Connection timed out 如何解决这个问题? ssh:连接到主机 github.com 端口 22:连接超时致命 - How to solve this? ssh: connect to host github.com port 22: Connection timed out fatal ssh:连接到主机 github.com 端口 22:连接超时致命:无法从远程存储库读取 - ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository GitHub 错误 - “ssh:连接到主机 github.com 端口 22:操作超时致命:无法从远程存储库读取。” - GitHub Error - "ssh: connect to host github.com port 22: Operation timed out fatal: Could not read from remote repository." `ssh:连接到主机 ssh.dev.azure.com 端口 22:连接超时`错误 - `ssh: connect to host ssh.dev.azure.com port 22: Connection timed out` error Github 连接到主机 github.com 端口 22:操作超时 - Github connect to host github.com port 22: Operation timed out ssh:连接到主机端口 22:连接超时 - ssh: connect to host port 22: Connection timed out ssh:连接到主机git.ionicjs.com端口22:连接超时 - ssh: connect to host git.ionicjs.com port 22: Connection timed out ssh:连接到主机 gitlab.com 端口 22:连接超时 - ssh: connect to host gitlab.com port 22: Connection timed out ssh:连接到主机github.com端口22:将VM复制到另一台主机后,网络无法访问 - ssh: connect to host github.com port 22: Network is unreachable after copying VM to another host machine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM