常用包管理器

66 阅读3分钟

常用包管理器

收集日常生活中常用的包管理器

node 包管理器

  1. nvm

    下载地址: 非window window

     nvm arch                     : Show if node is running in 32 or 64 bit mode.
     nvm current                  : Display active version.
     nvm install <version> [arch] : The version can be a specific version, "latest" for the latest current version, or "lts" for                                 the most recent LTS version. Optionally specify whether to install the 32 or 64 bit version                                 (defaults to system arch). Set [arch] to "all" to install 32 AND 64 bit versions. Add --                                    insecure to the end of this command to bypass SSL validation of the remote download server.
     nvm list [available]         : List the node.js installations. Type "available" at the end to see what can be installed.                                    Aliased as ls.
     nvm on                       : Enable node.js version management.
     nvm off                      : Disable node.js version management.
     nvm proxy [url]              : Set a proxy to use for downloads. Leave [url] blank to see the current proxy.
                                     Set [url] to "none" to remove the proxy.
     nvm node_mirror [url]        : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default                                  url.
     nvm npm_mirror [url]         : Set the npm mirror. Defaults to https://github.com/npm/cli/archive/. Leave [url] blank to                                    default url.
     nvm uninstall <version>      : The version must be a specific version.
     nvm use [version] [arch]     : Switch to use the specified version. Optionally use "latest", "lts", or "newest".
                                     "newest" is the latest installed version. Optionally specify 32/64bit architecture.
     nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode.
     nvm root [path]              : Set the directory where nvm should store different versions of node.js.
                                     If <path> is not set, the current root will be displayed.
     nvm version                  : Displays the current running version of nvm for Windows. Aliased as v.
    
  2. fnm

    下载地址:github

  3. volta

    下载地址:github

     # PNPM安装兼容
     在window 环境系统变量添加VOLTA_FEATURE_PNPM=1
     ​
     # 建议使用pin命令安装而不是直接使用install安装,install会替换全局的node包的,pin是在当前项目内有效
     volta pin node@xx
     ​
     # 常用命令
     fetch          Fetches a tool to the local machine
     install        Installs a tool in your toolchain
     uninstall      Uninstalls a tool from your toolchain
     pin            Pins your project's runtime or package manager     
     list           Displays the current toolchain
     completions    Generates Volta completions
     which          Locates the actual binary that will be called by Volta
     setup          Enables Volta for the current user / shell
     run            Run a command with custom Node, npm, pnpm, and/or Yarn versions
     help           Prints this message or the help of the given subcommand(s)
    

    目前在用

  4. nvs

    下载地址:github

  5. vfox

    下载地址:github

     vfox - VersionFox, a tool for sdk version management
     vfox available [<category>]     List all available plugins
     vfox add [--alias <sdk-name> --source <url/path> ] <plugin-name>  Add a plugin from offical repository or custom source
     vfox remove <sdk-name>          Remove a plugin
     vfox update <sdk-name>          Update a plugin
     vfox info <sdk-name>            Show plugin info
     vfox search <sdk-name>          Search available versions of a SDK
     vfox install <sdk-name>@<version> Install the specified version of SDK
     vfox uninstall <sdk-name>@<version> Uninstall the specified version of SDK
     vfox use [--global --project --session] <sdk-name>[@<version>]   Use the specified version of SDK for different scope
     vfox list [<sdk-name>]              List all installed versions of SDK
     vfox current [<sdk-name>]           Show the current version of SDK
     vfox help                      Show this help message
    

nodejs.org/dist/

参考文档:

比 nvm 更好用的 node 版本管理工具

  1. proto

    地址:moonrepo.dev/proto

    moonrepo.dev/docs/proto/…

    proto是一个版本管理工具,它不仅支持Node,还包括对npmpnpmBunDenoRustGoPython等等语言的管理,和Volta类似,它也可以为项目配置固定的软件版本,方便项目管理;同时,proto在安装Node时,并不会自动安装npm,而是要用户自行安装,所以当你升级切换node版本时,npm不会自行升级,即使手动升级了npm全局安装的包会被保留下来,并不像nvm那样必须重新安装

Go 多版本管理工具

  1. go get 命令
     go mod init <module-name>
     go get golang.org/dl/go<x.y>
     // go get golang.org/dl/go1.16.4
     go<x.y> download
     go<x.y> version
     
     // 切换全局 Go 版本:
     go<x.y> use
  1. Goenv Goenv 是另一个 Go 多版本管理工具,它的工作原理与其他语言的版本管理工具(如 Ruby 的 RVM 和 Python 的 pyenv)类似 github.com/go-nv/goenv
  2. GVM github.com/moovweb/gvm
  3. voidint/g

参考文档:

Go 多版本管理工具

Python 管理工具

  1. pyenv

    github.com/pyenv/pyenv

    github.com/pyenv-win/p…