【nexus2 & npm】nexus2架设npm私服

nexus2架设npm私服

//不能下载@开头组件,2.14迁移到3.1版本

//创建proxy仓库
1、选择菜单Respositories->Add->Proxy respository

2、填写属性
(1) npmjs
(2) npmjs registry
(3) npm
(4) https://registry.npmjs.org (国内可以填写https://registry.npm.taobao.org)
(5) Ignore


//创建私有npm仓库
1、选择菜单Respositories->Add->Hosted respository

2、填写属性
(1) npm-internal
(2) npm-internal
(3) npm

//创建仓库组
1、选择菜单Respositories->Add->Respository Group
2、填写属性
(1) npm-all
(2) npm-all
(3) npm
(4) 全选并点击中间的箭头加入到左边的列表

//从私服下载&上传依赖
//下载
//修改系统用户目录的.npmrc文件
registry=http://192.168.3.6:8023/nexus/content/groups/npm-all/

//测试有没有生效
cd ~ && mkdir npmtest  && cd npmtest  &&  npm init  && npm install vuex


//上传
//把这段代码直接粘贴到.npmrc文件中

init.author.name = Jane Doe
init.author.email = jane@example.com
init.author.url = http://blog.example.com
# an email is required to publish npm packages
email=jane@example.com
always-auth=true
_auth=YWRtaW46YWRtaW4xMjM=

//试一下刚才包发布:
npm publish --registry http://192.168.3.6:8023/nexus/content/repositories/npm-internal/

//nexus2无法支持npm范围发布的一次定位(无法下载 @type/node 的组件,)
//绕过的方式:
npm i -g @type/node --registry=https://www.npmjs.org

//清理本地缓存
npm cache clean --force

//所以需要 --no-shrinkwrap ,如果是源码上传,可能就不用参数 --no-shrinkwrap
npm install --no-shrinkwrap

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

子兮曰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值