美文网首页
Proxy Issue (in NPM or Git)

Proxy Issue (in NPM or Git)

作者: Kreiven | 来源:发表于2018-04-19 15:33 被阅读0次

    Issue

    You might want to give a try on configuring your proxy of npm or git if you ran into a problem with npm install or git clone, maybe like below:

    NPM

    npm ERR! network This is most likely not a problem with npm itself
    npm ERR! network and is related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad network settings.
    npm ERR! network
    npm ERR! network If you are behind a proxy, please make sure that the
    npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
    

    Git

    fatal: unable to access 'https://github.com/KreivenWang/KreivenWang.github.io.git/': Couldn't resolve host 'github.com'
    

    Configure

    NPM

    $ npm config set proxy http://my.webproxy.com:1234/
    $ npm config set https-proxy http://my.webproxy.com:1234/
    //test
    $ npm config get proxy
    $ npm config get https-proxy
    

    Git

    $ git config --global http.proxy http://my.webproxy.com:1234/
    $ git config --global https.proxy http://my.webproxy.com:1234/
    //test
    $ git config --global -l
    

    How do I know what proxy server I'm using?

    The auto proxy detection system works by downloading a file called wpad.dat from the host wpad. First confirm this host exists from a command prompt:

    > ping wpad
    

    If it doesn't exist, you may have to put the correct DNS suffix. In the same command prompt, type

    ipconfig /all
    

    You should see a Primary DNS Suffix and a DNS Suffix Search List

    Try appending each of these with a . to wpad:

    ping wpad.<primary dns suffix>
    

    If any of these work, then in your browser enter http://wpad.<suffix>/wpad.dat. This will download the proxy auto configuration file you can open in notepad.exe
    For example: http://wpad.my.primary.dns.suffix/wpad.dat

    Toward the bottom of this file, you should see a line saying

    PROXY <host:port>;
    

    It might be repeated if you have multiple proxies available. The host and port are what you need.

    If this file doesn't exist, then either there is no proxy server, or the proxy server is being provided by dhcp (note that this would only work with IE, so if firefox can surf, this is not the method being used). If you don't have access to the dhcp server to see what it is sending, the easiest way would be to open a site in ie, then go to a command prompt. Type

    netstat -ban
    

    This will provide a list of connections made with the process id of each process. Go to Task Manager, and select View/Select Columns and enable PID (Process Identifier). Look for the PID of iexplore.exe in the list returned by netstat -ban. This will reveal the proxy ip and port.

    # Can't bind to 'ngModel' since it isn't a known property of 'input'

    In the app.module.ts, I just added :

    import { FormsModule } from '@angular/forms';
    [...]
    @NgModule({
      imports: [
        [...]
        FormsModule
      ],
      [...]
    })
    

    Unable to clone Git repository due to self signed certificate

    $ git config --global http.sslVerify false
    $ git config --global https.sslVerify false
    

    相关文章

      网友评论

          本文标题:Proxy Issue (in NPM or Git)

          本文链接:https://www.haomeiwen.com/subject/tipwkftx.html