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

发布成功🎉

相关推荐
万少4 分钟前
DeepSeek-V4-Flash 正式版上线了,但这 3 个坑我帮你提前踩了
前端·javascript·后端
明月_清风7 分钟前
🚀 Palantir Foundry 本体论实战:当 Ontology 从"知识图谱"进化为"企业操作系统"
前端·后端
驳是8 分钟前
入坑 Nginx,看这一篇就够了
前端
宁风NF24 分钟前
JavaScript:网络请求与前端通信
开发语言·前端·javascript·网络·学习·ecmascript
明月_清风24 分钟前
从概念到代码:用 Ontology 构建你的第一个知识图谱
前端·后端
程序员黑豆42 分钟前
鸿蒙应用开发:AppStorage 全局状态存储用法教程
前端·harmonyos
猫猫不是喵喵.1 小时前
Vue3 中 computed 计算属性与 watch、watchEffect 监听
前端·javascript·vue.js
En^_^Joy1 小时前
Vue项目创建与入口配置全攻略
前端·vue.js·arcgis
孪生质数-1 小时前
AI Agent 工程实践(一):大模型 API 接入示范
网络·人工智能·ai·chatgpt·github·claude·claudecode
爱码小白1 小时前
importlib模块
开发语言·前端·python