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