Publishing with 2FA (Simplest Method)
Since npm deprecated classic tokens, the easiest way is to use 2FA with --otp flag.
Quick Setup (if 2FA not enabled)
npm profile enable-2fa auth-and-writes
Follow the prompts:
Publishing with OTP
cd packages/core
# Get 6-digit code from authenticator app, then:
npm publish --otp=123456
Replace 123456 with your actual code from the app.
Alternative: Granular Access Token (More Complex)
If you don't want to enter OTP every time:
.tmpThen I'll configure it.
Which Is Easier?
For one-time publishing: Use--otp (simpler!)
- Just need authenticator app
- Run
npm publish --otp=CODE - Done!
- More setup upfront
- No OTP needed each time
- Better for automation
Ready to Publish?
If you have 2FA enabled, just run:
cd packages/core
npm publish --otp=YOUR_CODE
Get the code from your authenticator app!