node如何更新?

摘要:node的更新方法:先使用npm的命令npm install -g n安装n模块,然后使用n stable可以将node更新到最新版本,使用n+node版本号可以将node更新到指定版本。

node的更新方法:先使用npm的命令npm install -g n安装n模块,然后使用n stable可以将node更新到最新版本,使用n+node版本号可以将node更新到指定版本。


更新node的方法:

一、使用npm 安装一个模块 n 到全局

 npm  install  -g  n

二、使用 n 安装最新版本:

n  stable

三、使用 n 加版本号就可以安装其他版本,比如:

n  6.11.3

四、再使用 n ,通过上下键,就可以选择不同的版本啦

注意:是从低版本升到高版本时多版本共存;如果是已经安装了高版本,再安装低版本时,高版本就没有了。

n模块的命令:

n help

  Usage: n [options/env] [COMMAND] [args]

  Environments:
    n [COMMAND] [args]            Uses default env (node)
    n project [COMMAND]           Uses custom env-variables to use non-official sources

  Commands:

    n                              Output versions installed
    n latest                       Install or activate the latest node release
    n -a x86 latest                As above but force 32 bit architecture
    n lts                          Install or activate the latest LTS node release
    n <version>                    Install node <version>
    n use <version> [args ...]     Execute node <version> with [args ...]
    n bin <version>                Output bin path for <version>
    n rm <version ...>             Remove the given version(s)
    n prune                        Remove all versions except the active version
    n --latest                     Output the latest node version available
    n --lts                        Output the latest LTS node version available
    n ls                           Output the versions of node available
    n uninstall                    Remove the installed node and npm

  Options:

    -V, --version   Output version of n
    -h, --help      Display help information
    -q, --quiet     Disable curl output (if available)
    -d, --download  Download only
    -a, --arch      Override system architecture

  Aliases:

    which   bin
    use     as
    list    ls
    -       rm
    stable  lts

本文内容仅供个人学习、研究或参考使用,不构成任何形式的决策建议、专业指导或法律依据。未经授权,禁止任何单位或个人以商业售卖、虚假宣传、侵权传播等非学习研究目的使用本文内容。如需分享或转载,请保留原文来源信息,不得篡改、删减内容或侵犯相关权益。感谢您的理解与支持!

链接: https://shenqiku.cn/article/FLY_8249