suchen

Heim  >  Fragen und Antworten  >  Hauptteil

node.js - 使用nvm安装node出现这个错误,怎么解决?

Could not retrieve https://nodejs.org/dist/lates...

PHP中文网PHP中文网2874 Tage vor486

Antworte allen(2)Ich werde antworten

  • 怪我咯

    怪我咯2017-04-17 15:53:00

    try again
    check network,try again
    restart try again

    Antwort
    0
  • 天蓬老师

    天蓬老师2017-04-17 15:53:00

    • nvm install v7.4.0的时候经常性的由于网络(GFW)的原因,现在binary的时候下载到一半突然断了,然后需要download source,重新compile,最终很容易造成失败

    • 所以决定用迅雷或者其他下载工具,下载包,放到nvm的cache目录里面,最后用nvm install命令,免去了终端下载中断之后从源码重试的尴尬,具体步骤如下

    • 下载包 https://nodejs.org/dist/v7.4.0/node-v7.4.0-darwin-x64.tar.gz,直接粘贴到迅雷里面就可以下载了

    • cd ~/.nvm/.cache/bin/

    • mkdir node-v7.4.0-darwin-x64 the prefix of file you downloaded

    • mv ~/Downloads/node-v7.4.0-darwin-x64.tar.gz ~/.nvm/.cache/bin/node-v7.4.0-darwin-x64, 使用自己下载的文件的存放路径替换上面的~/Downloads/node-v7.4.0-darwin-x64.tar.gz

    • nvm install v7.4.0, it will using the cache binary file, output the following msg

    Downloading and installing node v7.4.0...
    Local cache found: $NVM_DIR/.cache/bin/node-v7.4.0-darwin-x64/node-v7.4.0-darwin-x64.tar.gz
    Checksums match! Using existing downloaded archive $NVM_DIR/.cache/bin/node-v7.4.0-darwin-x64/node-v7.4.0-darwin-x64.tar.gz
    Now using node v7.4.0 (npm v4.0.5)

    Antwort
    0
  • StornierenAntwort