how can I solve this error in ionic `You must specify a “protocol” for the proxy type`

北慕城南 提交于 2020-01-06 06:59:49

问题


I ran ionic start series sidetabs in my Windows and got this error

TypeError: You must specify a "protocol" for the proxy type (http, https, socks, socks4, socks4a, socks5, socks5h, pac+data, pac+file, pac+ftp, pac+http, pac+https)
    at new ProxyAgent (C:\Users\sato\AppData\Roaming\npm\node_modules\@ionic\cli-plugin-proxy\node_modules\proxy-agent\index.js:97:11)
    at ProxyAgent (C:\Users\sato\AppData\Roaming\npm\node_modules\@ionic\cli-plugin-proxy\node_modules\proxy-agent\index.js:81:45)
    at Request.proxy (C:\Users\sato\AppData\Roaming\npm\node_modules\@ionic\cli-plugin-proxy\node_modules\superagent-proxy\index.js:71:15)
    at C:\Users\sato\AppData\Roaming\npm\node_modules\ionic\node_modules\@ionic\cli-utils\lib\http.js:31:17
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\sato\AppData\Roaming\npm\node_modules\ionic\node_modules\tslib\tslib.js:102:62)
    at <anonymous>

How do I solve this?


回答1:


For Windows, enter the SET command without quotes. The plugin cannot identify the protocol from the url if the text contains quotes. Might get fixed in future. As of now, this worked for me,

set HTTP_PROXY=http://proxy.company.com:port-number
set HTTPS_PROXY=http://proxy.company.com:port-number
set IONIC_HTTP_PROXY=http://proxy.company.com:port-number
set PROXY=http

This applies if your proxy is an HTTP proxy. If you have a SOCK proxy, you need to edit accordingly changing the url and proxy=sock




回答2:


my problem was solved with the command npm config unset -g proxy



来源:https://stackoverflow.com/questions/48020971/how-can-i-solve-this-error-in-ionic-you-must-specify-a-protocol-for-the-proxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!