Git cloning NVM is slow and often freezes

  • why

    Git clones request the destination repository from GitHub. For some reason, GitHub is very unstable to access at home, so processes can get stuck or fail

  • The solution

    You can use the following domestic mirror sites to accelerate,

    fastgit.org
    gitclone.com
    cnpmjs.org

2 Node acceleration for NVM installation

  • NVM install downloads node packages from nodejs.org/dist/ by default, which is slow because the server is deployed abroad

  • The solution

    NVM specifies the download source, sets environment variables, and points the download source to taobao image to speed up the installation

Specify environment variables to speed up a single installation

  NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node nvm install v12.19.0
Copy the code

Add environment variables to the configuration file and use NVM Install to speed things up by default

Write the environment variables to the nvm.sh file

export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
Copy the code

Write environment variables to the.bashrc file

# nvm
export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
source ~/git/nvm/nvm.sh
Copy the code

Actually typing commands directly into the shell can also be accelerated

export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
Copy the code