npm gets stuck on fetchMetadata -> network

前端 未结 11 1684
栀梦
栀梦 2020-12-24 04:32

My npm is getting stuck a lot, whether its npm install from package.json or individual packages.

Right now, I\'m not even able to sudo npm install

相关标签:
11条回答
  • 2020-12-24 05:11

    I got the same issue. First of all try to run npm install with -verbose flag. That can help you identify your problem.

    That command told me that I had some problem with tunneling socket:

    tunneling socket could not be established, cause=write EPROTO 101057795:error:140770FC:SSL routines:SSL 23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:

    After that I googled the error and found thread on github about that problem. The problem was in proxy: previously I set up HTTP_PROXY environment variable and after removing then environment variable npm install completed without any error.

    0 讨论(0)
  • 2020-12-24 05:13

    try yarn installer instead of npm:

    sudo npm install -g yarn
    yarn install
    

    I found it much more resilient to such problems.

    0 讨论(0)
  • 2020-12-24 05:15

    Did you configured a proxy? See if this returns something:

    npm config get https-proxy
    npm config get proxy
    

    If you have values configured there, they might not match correct ones. If you shouldn't be using a proxy, you can delete them:

    npm config delete https-proxy
    npm config delete proxy
    

    Docs: https://docs.npmjs.com/cli/config

    0 讨论(0)
  • 2020-12-24 05:15

    Having same problem. Fixed it by switching to correct version of node required by the project.

    My project needed node >=v4.3 and <=v5.

    1) Check node version being used by nvm ls

    2) Use nvm use [version] or else install the specific version. if you don't have.

    0 讨论(0)
  • 2020-12-24 05:17

    For me it was double temp directories in Windows.

    Open a command prompt and type:

    echo %TEMP%
    

    You should receive path to a single directory. If you receive multiple directories (I received C:\Users\\AppData\Local\Temp;C:\xampp\php) this might be the problem. You can fix it using this command:

    SET TEMP="<correct path to temporary directory>"
    

    where <correct path to temporary directory> might be the first path (before semicolon, that means C:\Users\<user>\AppData\Local\Temp in my case).

    0 讨论(0)
  • 2020-12-24 05:18

    You'll need to clear your https proxy settings:

    npm config rm proxy
    npm config rm https-proxy
    
    0 讨论(0)
提交回复
热议问题