npm: publish 报错 OTP/npm token
一个npm 报错处理
现场
npm notice
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public 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: /Users/feizheng/.npm/_logs/2025-12-11T08_59_36_596Z-debug-0.log解决方案
npm publish在线输入这个码- 下次就不会了
Authenticate your account at:
https://www.npmjs.com/auth/cli/26676048-cd6a-47fa-b1be-d039b2811b65
Press ENTER to open in the browser...
+ @jswork/ushell-module-nodejs@1.0.73测试NPM token
测试本地设置的
token是否有效,登录是否正常
strict-ssl=false
registry=https://registry.npmjs.org
//npm.pkg.github.com/:_authToken=YOUR_TOKEN1
//registry.npmjs.org/:_authToken=YOUR_TOKEN2
//repos.saybot.net/repository/alo7-private-npm/:_authToken=YOUR_TOKEN3
@afeiship:registry=https://npm.pkg.github.com
git-tag-version=false
init-author-name=afeiship
proxy=false测试登录情况
npm whoami