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

发布成功🎉

相关推荐
C_心欲无痕21 小时前
前端实现水印的两种方式:SVG 与 Canvas
前端·安全·水印
尾善爱看海1 天前
不常用的浏览器 API —— Web Speech
前端
美酒没故事°1 天前
vue3拖拽+粘贴的综合上传器
前端·javascript·typescript
jingling5551 天前
css进阶 | 实现罐子中的水流搅拌效果
前端·css
悟能不能悟1 天前
前端上载文件时,上载多个文件,但是一个一个调用接口,怎么实现
前端
可问春风_ren1 天前
前端文件上传详细解析
前端·ecmascript·reactjs·js
羊小猪~~1 天前
【QT】--文件操作
前端·数据库·c++·后端·qt·qt6.3
晚风资源组1 天前
CSS文字和图片在容器内垂直居中的简单方法
前端·css·css3
Miketutu1 天前
Flutter学习 - 组件通信与网络请求Dio
开发语言·前端·javascript
光影少年1 天前
前端如何调用gpu渲染,提升gpu渲染
前端·aigc·web·ai编程