由于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

发布成功🎉

相关推荐
codingandsleeping13 分钟前
OSI 七层网络模型
前端·网络协议·http
codingandsleeping15 分钟前
TCP 三次握手与四次挥手
前端·网络协议
GUIQU.22 分钟前
【JavaScript】ES6+ 新特性
前端·javascript·es6
小白_ysf1 小时前
《前端面试题之 CSS篇(第一集)》
前端·css·面试题
患得患失9491 小时前
【前端】【css】flex布局详解
前端·css
gqkmiss1 小时前
AbortController:让异步操作随时说停就停
前端·async·异步·steam·abortcontroller
uhakadotcom1 小时前
CVE-2025-30208:Vite 开发服务器安全漏洞解析
后端·面试·github
getapi2 小时前
Flutter 强制横屏
前端·javascript·flutter
MrsBaek2 小时前
【前端笔记】CSS预处理语言 LESS
前端·css·笔记
gqkmiss2 小时前
ChromeOS 135 版本更新
前端·chrome·浏览器·chromeos