简体   繁体   中英

Error: Invalid protocol

I am facing this issue while making a request to any url using 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".

My .npmrc file contains following lines

    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"

Still no solution 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 . 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. Please provide some solution i am stuck.

PS: Also tried by changing http To https for https-proxy .

Npmrc is used by npm, not (afaik) requests within your node code, so this is probably a red herring. What code are you using to make the request?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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