npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ftdsy-attr

v2.2.9

Published

当前项目的账号被限制了2FA, 导致无法直接上传,需使用令牌进行

Readme

当前项目的账号被限制了2FA, 导致无法直接上传,需使用令牌进行

第一步:登录 npm 官网

打开浏览器,访问 https://www.npmjs.com。 使用你的账号密码登录。 注意:如果登录时它也要求你输入 2FA 验证码,而你没有,请点击登录框下方的 "Use a recovery code"(使用恢复代码)。 如果你当初开启时保存了恢复代码:输入它即可登录。 如果你完全没有恢复代码,且登录都进不去:那你只能联系 npm 支持团队(见文末“终极求助”)。 假设你能成功登录进入后台。

第二步:生成“绕过 2FA”的令牌

  1. 点击右上角头像 -> Account Settings。
  2. 在左侧菜单找到并点击 Access Tokens。
  3. 点击绿色的 Generate New Token 按钮。
  4. 选择 Granular Token (细粒度令牌) ——不要选 Classic 或 Automation,选 Granular 最稳妥。
  5. 填写配置: Name: 随便填,例如 my-publish-token。 Scopes (权限): 勾选 Read and Write (或者只勾选 Publish packages)。 关键一步: 在下方找到 "Bypass two-factor authentication for this token" (为此令牌绕过双重验证) 选项,务必勾选它! 解释:勾选后,使用此 Token 进行操作时,npm 服务器将不再检查你的 2FA 状态。
  6. 点击 Generate Token。
  7. 复制生成的令牌字符串(以 npm_ 开头的一长串字符)。 ⚠️ 警告:这个字符串只显示一次!一旦刷新页面就看不到了。请立即复制并保存好(可以暂时存在记事本里)。

第三步:在本地终端配置令牌

回到你的 PowerShell 终端 (PS E:Projecttoolsattr-change>)。 先确保退出之前的登录状态(避免冲突):

npm logout

将刚才复制的 Token 写入 npm 配置:

npm config set //registry.npmjs.org/:_authToken=你token字符串

(请将 你的_token_字符串 替换为你刚才复制的那一大串字符,不要加引号)

例如:npm config set //registry.npmjs.org/:_authToken=npm_CcT7...xyz

验证是否配置成功:

npm whoami

如果输出了你的用户名,说明配置成功,且此时你已经是“免 2FA”状态。

第四步:再次发布 现在直接运行发布命令,应该不会再报 403 错误,也不需要任何验证码:

npm publish