简体   繁体   English

使用npm安装grunt-browser-sync时出错

[英]Error when installing grunt-browser-sync with npm

I'm trying to install the grunt-browser-sync plugin via npm (version 3.3.8): 我正在尝试通过npm (版本3.3.8)安装grunt-browser-sync插件:

npm install grunt-browser-sync --save-dev

First my terminal hangs at loading xmlhttprequest: 首先,我的终端在加载xmlhttprequest时挂起了: 在此处输入图片说明

Then after waiting a while, I get this error: 然后等待一会儿,我得到这个错误: 在此处输入图片说明

If I navigate in my browser to the url https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz , it works.. 如果我在浏览器中导航到URL https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz ,则可以使用。

I'm working on Windows 7 Enterprise. 我正在使用Windows 7 Enterprise。
npm version 3.3.8. npm版本3.3.8。
I'm working behind a proxy, but the settings are correct, because I can install other npm modules . 我正在使用代理,但是设置正确,因为我可以安装其他npm模块

What I already tried: 我已经尝试过的

  • use different version of npm (3.3.1, 3.3.5, 3.3.6, 3.3.7) 使用不同版本的npm(3.3.1、3.3.5、3.3.6、3.3.7)
  • npm cache clean npm缓存清理

The issue seems to be that npm is not that great with HTTPS over a proxy. 问题似乎是npm在代理上的HTTPS方面不是很好。 Changing the registry URL from HTTPS to HTTP is a work around: 将注册表URL从HTTPS更改为HTTP可以解决以下问题:

npm config set registry http://registry.npmjs.org/

But your problem doesn't seems to end here as it's not getting the dependency from http://registry.npmjs.org , 但是您的问题似乎并没有到此结束,因为它没有从http://registry.npmjs.org获得依赖,
but from: https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz 但来自: https : //github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz

Since you're behind a proxy, using npm can be a real pain sometimes. 由于您在使用代理,因此有时使用npm可能会很痛苦。 So you've to configure npm to work with your web proxy. 因此,您必须配置npm以与Web代理一起使用。 Here is an example: 这是一个例子:

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

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM