npm(节点包管理器)超时

时间:2014-08-24 08:54:40

标签: node.js npm

我不能用npm安装任何模块。它只是超时

C:\Users\athakur>npm install express -g
npm http GET http://registry.npmjs.org/express
npm http GET http://registry.npmjs.org/express
npm http GET http://registry.npmjs.org/express
npm ERR! network connect ETIMEDOUT
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 settin
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'

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Users\\athakur\\Softwares\\NodeJS\\\\node.exe" "C:\\Users\
kur\\Softwares\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "express"
npm ERR! cwd C:\Users\athakur
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.9
npm ERR! syscall connect
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\athakur\npm-debug.log
npm ERR! not ok code 0

我不在任何代理之后。 Ping工作得很好

C:\Users\athakur>ping registry.npmjs.org

    Pinging a.sni.fastly.net [103.245.222.162] with 32 bytes of data:
    Reply from 103.245.222.162: bytes=32 time=442ms TTL=53
    Reply from 103.245.222.162: bytes=32 time=590ms TTL=53
    Reply from 103.245.222.162: bytes=32 time=538ms TTL=53
    Reply from 103.245.222.162: bytes=32 time=656ms TTL=53

    Ping statistics for 103.245.222.162:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 442ms, Maximum = 656ms, Average = 556ms

我尝试运行npm config set registry http://registry.npmjs.org/并检查相同内容会反映在我的用户目录下的.npmrc文件中。我无法理解为什么它会超时。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

这可能是阻止你的git的东西。你能用git://协议做git clone吗? 您可以尝试使用以下命令将其更改为https:

git config --global url."https://".insteadOf git://