[英]Error: Invalid protocol
I am facing this issue while making a request to any url using NodeJS. 我在使用NodeJS向任何网址发出请求时遇到了这个问题。 FYR i have made a script in nodejs which is using request module that calls a page and then scrap that html page but the issue is when it calls i gets an error "Error: Invalid protocol: 10.112.62.78".
FYR,我已经在nodejs中制作了一个脚本,该脚本正在使用请求模块来调用页面,然后废弃该html页面,但是问题是当它调用我时出现错误“错误:无效的协议:10.112.62.78”。
My .npmrc file contains following lines 我的.npmrc文件包含以下几行
proxy=http://10.112.62.78:8080
https-proxy=http://10.112.62.78:8080
registry=http://registry.npmjs.org/
and i still get following error 而且我仍然收到以下错误
[Error: Invalid protocol: 10.112.62.78:]
I have tried all possible combinations of following 我尝试了以下所有可能的组合
http://user:password@proxy:port
http://"user:password"@proxy:port
For the above two i get "URI Malformed error" 对于上述两个我得到“ URI格式错误”
Still no solution http://proxy.company.com:port 仍然没有解决办法http://proxy.company.com:port
FYI Versions are as follows: 供参考的版本如下:
>node -v
>v0.12.0
>npm -v
>2.5.1
There is one more info i have static ip of 10.112.111.86 in IPv4 and ip of 10.112.62.78 with 8080 in Proxy Setting of Browser . 还有一个更多的信息,我在IPv4中有10.112.111.86的静态IP,在浏览器的代理设置中有8080的IP是10.112.62.78。 Also i am using Windows 7 desktop and i tried with Proxy IP of 10.112.62.78 & without it but no solution however i can't change the IPv4 otherwise my internet connection would be gone.
我也使用Windows 7桌面,我尝试使用10.112.62.78的代理IP,但没有它,但没有解决方案,但是我无法更改IPv4,否则我的互联网连接就会消失。 Please provide some solution i am stuck.
请提供一些解决方案,我被困住了。
PS: Also tried by changing http To https for https-proxy . PS:也尝试通过将HTTP更改为https-proxy到https来尝试。
Npmrc is used by npm, not (afaik) requests within your node code, so this is probably a red herring. Npmrc由npm使用,而不是节点代码中的(afaik)请求,因此这可能是一个红色鲱鱼。 What code are you using to make the request?
您使用什么代码发出请求?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.