包管理工具-npm

本地操作

1.安装npm包

npm install lodash(包名)

安装指定版本号

npm install lodash@0.9.1

获取所有可用的版本号

npm view lodash@* version

2.查看已安装的npm包

带依赖关系

npm -g list

不带依赖关系

//查看全局的
npm list -g --depth=0

//查看项目中的
npm list --depth=0 [--dev | --production]

说明:

  • npm : the Node package manager command line tool npm :Node包管理器命令行工具
  • list -g : display a tree of every package found in the user’s folders (without the -g option it only shows the current directory’s packages) list -g :显示在用户文件夹中找到的每个包的树(没有-g选项,它只显示当前目录的包)
  • depth 0 / — depth=0 : avoid including every package’s dependencies in the tree view depth 0 / - depth = 0 :避免在树视图中包含每个包的依赖关系

3.更新本地npm包

npm update

4.找出需要更新的包

npm outdated

5.卸载npm包

npm uninstall lodash(包名)

npm uninstall --save lodash(包名) //卸载dependencies中的npm包

npm uninstall --save-dev lodash(包名) //卸载devdependencies中的npm包

全局操作 【加上-g】

1.更新所有npm包

**npm update -g **

2.找出哪些包需要被更新

**npm outdated -g --depth=0 **

3.更新具体某个包

**npm update -g jshint **

4.更新npm本身

**[sudo] npm install npm@latest -g **

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值