NPM命令

作者: Lonely小宇 | 来源:发表于2022-01-18 11:44 被阅读0次

    NPM 控制命令

    # 帮助
    npm help <cmd> 
    # 使用淘宝源
    npm config set registry https://registry.npm.taobao.org
    npm config set strict-ssl false 
    # 升级 NPM
    npm i npm [-g|--global] 
    # 修改配置
    npm config set <key> <value> [-g]
    npm config get <key>
    npm config delete <key>
    npm config edit [-g]
    npm get <key>
    npm set <key> <value> [-g] 
    # 查看配置
    npm config ls [-g] [-l|--long] 
    # NPM 全局包位置
    npm get prefix 
    # 初始化 
    package.json
    npm init [-y|--yes]
    

    NPM 包管理命令

     # 安装包 install
    npm i <pkg>@<version> [-g|--global, -S|--save, -D|--save-dev, -O|--save-optional] 
    # 删除包 uninstall
    npm rm <pkg> [-S, -D, -O] 
    # 更新包
    npm update <pkg> [-g]
    # 连依赖一起更新 
    npm update <pkg> [-g] --depth 999 
    # 列出过期的包
    npm outdated [-g] 
    # 查看安装的包
    npm ls/ll [-g] --depth 0
     # 锁定依赖版本
    npm shrinkwrap
    

    一个很好玩的命令

    npm explore <pkg> [-g]
    

    相关文章

      网友评论

          本文标题:NPM命令

          本文链接:https://www.haomeiwen.com/subject/hmdkhrtx.html