• archlinux 上使用 nvm 来管理npm版本


    archlinux 上使用 nvm 来管理 npm 版本

    nvm-github

    Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions

    1. 安装 nvm

    sudo pacman -S nvm
    
    • 1

    不知道为什么使用pacman安装的nvm,是找不到命令的,所以我还是使用脚本安装。

    使用脚本安装

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
    • 1

    Running either of the above commands downloads a script and runs it. The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

    2. nvm的基础使用

    To download, compile, and install the latest release of node, do this:

    nvm install node # "node" is an alias for the latest version
    
    • 1

    To install a specific version of node:

    nvm install 14.7.0 # or 16.3.0, 12.22.1, etc
    
    • 1

    And then in any new shell just use the installed version:

    nvm use node
    
    • 1

    Or you can just run it:

    nvm run node --version
    
    • 1

    Or, you can run any arbitrary command in a subshell with the desired version of node:

    nvm exec 4.2 node --version
    
    • 1

    You can also get the path to the executable to where it was installed:

    nvm which 12.22
    
    • 1

    2.2. List version

    If you want to see what versions are installed:

    nvm ls
    
    • 1

    If you want to see what versions are available to install:

    nvm ls-remote
    
    • 1
  • 相关阅读:
    [题] 快速排序 #分治
    国内软件测试岗,可以卷到什么程度?
    Redis 做签到统计
    linux系统Jenkins的安装
    织信Informat如何连接其他应用?
    Elasticsearch深入理解(十四)——数据建模规范
    Electron基本介绍
    电阻的基础与应用
    【MySQL】索引与事务
    STM32驱动HC05蓝牙串口通信模块
  • 原文地址:https://blog.csdn.net/Leiyi_Ann/article/details/126639813