npm的使用

50 篇文章 0 订阅
6 篇文章 0 订阅

npm是Node Package Manger 的缩写,是node的包管理工具。

npm的使用说明如下:
以underscore插件为例

// 查看所有安装的包
npm list

// 查看underscore最新的版本
npm info underscore

// 查看underscore最新的版本(同 npm info underscore)
npm view underscore version

// 查看underscore所有的版本
npm view underscore versions

// 安装underscore特定版本
npm install underscore@1.8.0

// 查看underscore包的版本信息
npm ls underscore

// 查看全局中underscore包的版本信息
npm ls underscore -g

// 卸载underscore
npm uninstall underscore

// 只装生产环境的包
npm i --production

// 查看过期包
npm outdated

// 版本更新
npm update

// 清除缓存
npm cache clean --force

// 注册npm仓库账号 https://www.npmjs.com 上面的账号
npm adduser

// 上传包
npm publish

// 查看npm源:
npm config get registry

// 切换npm源方法一:
npm config set registry http://registry.npmjs.org

// 切换npm源方法二:
nrm use npm

// 卸载包

查看当前项目引用了哪些包
npm ls
卸载包:
npm unpublish --force

// npm 安装git上发布的包

# 这样适合安装公司内部的git服务器上的项目
npm install git+https://git@github.com:lurongtao/gp-project.git

#或者以ssh的方式
npm install git+ssh://git@github.com:lurongtao/gp-project.git

在项目中一般这样用:
"devDependencies": {
    "@anyi/anyi-ui": "git+http://downloader:downloader@gogs.pms.anyi-tech.com/anyi-front/anyi-ui.git#1.2.37",
    ........
    ........
}  
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值