npm设置仓库


1.通过config命令

npm config set registry https://registry.npm.taobao.org 

npm config list #查看npm当前配置

2.命令行指定
每次执行命令前加入–registry指定仓库路径

npm --registry https://registry.npm.taobao.org install

3.编辑 ~/.npmrc 加入下面内容

registry = https://registry.npm.taobao.org



$ npm adduser	
Username: your name
Password: your password
Email: yourmail[@gmail](/user/gmail).com

如果出现以下错误,可能是你的npm版本太低,通过sudo npm install -g npm升级一下。

npm WARN adduser Incorrect username or password
npm WARN adduser You can reset your account by visiting:
npm WARN adduser 
npm WARN adduser     http://admin.npmjs.org/reset
npm WARN adduser 
npm ERR! Error: forbidden may not mix password_sha and pbkdf2
npm ERR! You may need to upgrade your version of npm:
npm ERR!   npm install npm -g
npm ERR! Note that this may need to be run as root/admin (sudo, etc.)

成功之后,npm会把认证信息存储在~/.npmrc中,并且可以通过以下命令查看npm当前使用的用户:

$ npm whoami 
 
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值