由于Two-Factor Authentication导致github发布npm包失败

bash 复制代码
npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access
npm error code EOTP
npm error This operation requires a one-time password from your authenticator.
npm error You can provide a one-time password by passing --otp=<code> to the command you ran.
npm error If you already provided a one-time password then it is likely that you either typoed
npm error it, or it timed out. Please try again.
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2024-11-20T03_10_55_188Z-debug-0.log
Error: Process completed with exit code 1.

使用github的action自动发布npm包时出现了npm error If you already provided a one-time password then it is likely that you either typoed的错误,我确定使用的access token是没有问题的,之前还能正常发布。一想应该是之前配置了npm 的Two-Factor Authentication有关,需要通过使用验证软件上的临时验证码才能通过。

然后找到了npm里面Account > Two-Factor Authentication> 点击Modify 2FA。

找到Additional Options,去掉Require two-factor authentication for write actions的勾选,然后更新即可。

这是后再触发github action就可以了

bash 复制代码
npm notice package size: 1.7 kB
npm notice unpacked size: 3.3 kB
npm notice shasum: 22098ce85d9c2be41866569e77ea29bcf655b683
npm notice integrity: sha512-FE6NK5bvfR3VP[...]7lrEMnbKYQxYg==
npm notice total files: 8
npm notice
npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access

发布成功🎉

相关推荐
然我几秒前
不用 Redux 也能全局状态管理?看我用 useReducer+Context 搞个 Todo 应用
前端·javascript·react.js
前端小巷子6 分钟前
Web 实时通信:从短轮询到 WebSocket
前端·javascript·面试
神仙别闹9 分钟前
基于C#+SQL Server实现(Web)学生选课管理系统
前端·数据库·c#
web前端神器16 分钟前
指定阿里镜像原理
前端
枷锁—sha20 分钟前
【DVWA系列】——CSRF——Medium详细教程
android·服务器·前端·web安全·网络安全·csrf
枷锁—sha22 分钟前
跨站请求伪造漏洞(CSRF)详解
运维·服务器·前端·web安全·网络安全·csrf
群联云防护小杜38 分钟前
深度隐匿源IP:高防+群联AI云防护防绕过实战
运维·服务器·前端·网络·人工智能·网络协议·tcp/ip
汉得数字平台1 小时前
【鲲苍提效】全面洞察用户体验,助力打造高性能前端应用
前端·前端监控
花海如潮淹1 小时前
前端性能追踪工具:用户体验的毫秒战争
前端·笔记·ux
松哥_ai自动化3 小时前
从抓包GitHub Copilot认证请求,认识OAuth 2.0技术
github·copilot