问题描述
我需要在两个不同范围内设置多个npm令牌
@scope1:registry=https://registry.npmjs.org/
@scope2:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
我尝试将auth令牌添加到每个作用域
@scope1:registry=https://registry.npmjs.org/:_authToken=${TOKEN_1}
@scope2:registry=https://registry.npmjs.org/:_authToken=${TOKEN_2}
但是我在尝试安装软件包时得到405
。
我尝试查找文档:https://docs.npmjs.com/using-npm/config,但找不到为不同范围指定不同标记的方法
解决方法
我联系了npm支持部门,并得到以下答复:
用户不能混合和匹配单个注册表的身份验证。我们建议有一个npm用户,该用户被授予对所有软件包的访问权限,并为该用户使用令牌。