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

发布成功🎉

相关推荐
裴嘉靖19 小时前
uniapp做的APP和安卓苹果做的什么区别
前端
申阳19 小时前
Day 20:开源个人项目时的一些注意事项
前端·后端·程序员
天蓝色的鱼鱼19 小时前
大文件上传实战:基于Express、分片、Web Worker与压缩的完整方案
前端·node.js
500佰19 小时前
解读NotebookLM基于AI的PTT生成 程序化处理方法
前端·google·程序员
前端老宋Running19 小时前
别再给组件“打洞”了:这才是 React 组件复用的正确打开方式
前端·javascript·前端框架
u***284719 小时前
Spring Boot项目接收前端参数的11种方式
前端·spring boot·后端
pcm12356719 小时前
java中用哈希表写题碰到的误区
java·前端·散列表
盗德19 小时前
最全音频处理WaveSurferjs配置文档二(事件)
前端·javascript
恋猫de小郭19 小时前
解读 Claude 对开发者的影响:AI 如何在 Anthropic 改变工作?
android·前端·ai编程
Evan芙19 小时前
shell编程求10个随机数的最大值与最小值
java·linux·前端·javascript·网络