How to clear https proxy setting of NPM?

前端 未结 30 2278
长发绾君心
长发绾君心 2020-11-29 14:59

How can I clear the previous ssl proxy setting of NPM? well, I search a lot, but all post I got is mainly about how to set proxy in corporate network.

30条回答
  •  死守一世寂寞
    2020-11-29 15:29

    If you go through the npm config documentation, it says:

    proxy

    Default: HTTP_PROXY or http_proxy environment variable, or null

    Type: url

    As per this, to disable usage of proxy, proxy setting must be set to null. To set proxy value to null, one has to make sure that HTTP_PROXY or http_proxy environment variable is not set. So unset these environment variables and make sure that npm config ls -l shows proxy = null.

    Also, it is important to note that:

    • Deleting http_proxy and https_proxy config settings alone will not help if you still have HTTP_PROXY or http_proxy environment variable is set to something and
    • Setting registry to use http:// and setting strict-ssl to false will not help you if you are not behind a proxy anyway and have HTTP_PROXY set to something.

    It would have been better if npm had made the type of proxy setting to boolean to switch on/off the proxy usage. Or, they can introduce a new setting of sort use_proxy of type boolean.

提交回复
热议问题