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

发布成功🎉

相关推荐
一 乐几秒前
绿色农产品销售|基于springboot + vue绿色农产品销售系统(源码+数据库+文档)
java·前端·数据库·vue.js·spring boot·后端·宠物
zzjyr1 分钟前
Webpack 生命周期原理深度解析
前端
xiaohe06014 分钟前
💘 霸道女总裁爱上前端开发的我
前端·游戏开发·trae
sophie旭7 分钟前
内存泄露排查之我的微感受
前端·javascript·性能优化
阿里嘎多学长12 分钟前
2026-01-11 GitHub 热点项目精选
开发语言·程序员·github·代码托管
三两肉13 分钟前
HTTPS ECDHE 握手全解析
网络协议·https·github·rsa·echde
k***19514 分钟前
Spring 核心技术解析【纯干货版】- Ⅶ:Spring 切面编程模块 Spring-Instrument 模块精讲
前端·数据库·spring
啊湘40 分钟前
vscode 使用 github (适用CURSOR等使用)
ide·vscode·github·cursor·mcp
rgeshfgreh1 小时前
Spring事务传播机制深度解析
java·前端·数据库
l1t1 小时前
利用DeepSeek辅助拉取GitHub存储库目录跳过特定文件方法
人工智能·github·deepseek