[英]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.