Skip to content

Instantly share code, notes, and snippets.

@janily
Created November 19, 2022 07:33
Show Gist options
  • Save janily/8de7806b9d32b91dd56b79a9a7691318 to your computer and use it in GitHub Desktop.
Save janily/8de7806b9d32b91dd56b79a9a7691318 to your computer and use it in GitHub Desktop.

Revisions

  1. janily created this gist Nov 19, 2022.
    16 changes: 16 additions & 0 deletions nvm install
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    // 拷贝资源
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

    // 然后再执行以下两步把环境指向这个安装文件
    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

    // 执行完以上步骤后就可以通过这个测试
    command -v nvm
    上面这个打印出 nvm 就说明可以了

    // 安装并切换到 node 版本
    nvm install 10.0

    // 直接切到 node 版本,前提是这个 node 安装过
    nvm use 10.0