not able to install node_modules

前端 未结 5 1631
我在风中等你
我在风中等你 2021-01-02 04:06

I am trying to install node_module but getting following error:

For example:npm install grunt-preprocess

D:\\grunt_pre>npm install grunt-preproces         


        
相关标签:
5条回答
  • 2021-01-02 04:35

    The registry URL is pointing to https, you could try changing it by

    npm config set registry="http://registry.npmjs.org/"
    

    and then try installing the module. It may be possible that you are behind a proxy that is blocking secure (https) connections

    If it doesn't work then may be you could manually try to download the current version of the module you are trying to install from the here

    And run the command npm install grunt-preprocess-2.3.0.tgz

    0 讨论(0)
  • 2021-01-02 04:35

    This might be a problem with module bin-wrapper which does not respect proxies and that is why you see the ETIMEDOUT error when trying to download.

    To solve the issue you can set the environment variable HTTP_PROXY and/ or HTTPS_PROXY.
    Works under Windows/ Linux.

    The solved bin-wrapper issue.
    Commit with fix.

    The code piece in the fix:

    var proxyServer = process.env.HTTPS_PROXY || 
                      process.env.https_proxy ||
                      process.env.HTTP_PROXY ||
                      process.env.http_proxy;
    
    0 讨论(0)
  • 2021-01-02 04:51

    Try the answer by @ Canmah. If it does not help try to check your proxy configuration.

    If there is a proxy, update the npm registry as mentioned below and then try installing the node module.

    @ the command prompt update the 
    npm config set proxy <proxyserver>:<port>
    
    0 讨论(0)
  • 2021-01-02 04:59

    I'm getting the exact same thing. Either the module exists but the actual download repository is down or there is a problem with npm at the moment. Try again in a few days or report it to the github link.

    Edit:

    The error you are getting is a timeout from their server or your connection. It could be because you are behind a firewall/proxy that is stopping your connections.

    0 讨论(0)
  • 2021-01-02 05:00

    I also had ETIMEDOUT errors and was able to resolve the issue by disabling my router's firewall, rebooting it, and most importantly, configuring the number of simultaneous connections with the following npm command:

    npm set maxsockets 3
    

    This sets a max number of connections of 3, instead of the default 50. The CLI has been allowing this option since npm@3.8.0. See this link for further reference.

    0 讨论(0)
提交回复
热议问题