npm - 如何使用 Auth Token 将作用域 npm 包发布到私有 Bytesafe npm 注册表
问题描述
我正在尝试使用 AUTH TOKEN 编写我的第一个 npm 包并测试发布到我的私有 bytesafe npm 注册表,然后再继续并合并来自 CI 管道的发布。
我已经登录到我的 bytesafe 目录并获得了一个 TOKEN:
npm --registry https://<<my.bytesafe.registry string goes here>> login with User: bytesafe Password: <passwd>
npm --registry https://<<my.bytesafe.registry string goes here>> token create Password: <passwd>
我创建了我的 ~/.npmrc 文件,如下所示:
//<<my.bytesafe.registry string goes here>>/:_authToken=${NPM_TOKEN}
registry=https://<<my.bytesafe.registry string goes here>
email=<my email addess>
always-auth=true
我的package.json
:
{
"name": "@spears/tryitandsee",
"version": "1.0.1-0",
...
"publishConfig": {
"registry": "https://<my.bytesafe.registry string goes here>"
}
}
当我运行npm publish
时,我收到以下错误消息:
npm ERR! code E401
npm ERR! 401 Unauthorized - PUT https://<my.bytesafe.regsitry string goes here>/@spears%2ftryitandsee - Access Denied
如何使用身份验证令牌发布到私有 npm 注册表?
解决了!这是一个错字问题!
解决方案
支持将作用域包发布到私有注册表,因此这很可能与过期令牌有关。
希望您已经设法解决了您的问题。如果您的私有注册表仍然存在问题,我建议您通过https://bytesafe.dev联系支持人员,因为我们很乐意帮助您解决问题。
/Martin,字节安全团队
推荐阅读
- typescript - 打字稿字符串日期类型定义
- itext7 - 我可以在 vb.net 中使用 itext 7 从 PDF 中提取表格吗,如果可以,请分享一些代码建议
- python - PermissionError:[Errno 13] 下载电子邮件附件时权限被拒绝
- reactjs - Django React:如何将 Axios 标头中的令牌传递给 fullfil 'rest_framework.permissions.IsAuthenticated'
- android - Firebase 分析事件 app_clear_data
- python - 如何在 VSCode 上为 Python 启用 linting?
- python - Python & Docker 不清理线程
- python - 如何一次发送 10 个 python get 请求
- java - @TransactionalEventListener 如何绑定 TransactionManager
- mysql - 根据行值加入新列