Is it possible to change npm user?

I'd suggest to contact npm support for this. AFAIK there is no publicly available, official way to change your registered user name.

From my experience, they are very helpful and nice :-)


The npm support told me to create a new account and move packages manually. Not great.

So here's a way to move your existing packages to your new account:

  1. Log into your old account on both https://www.npmjs.com and on your bash/zsh terminal
  2. Get a list of your current npm packages:

    1. Go to your profile on npmjs.com
    2. Expand the whole list until there's no more "show more packages" button
    3. Run this in your browser's console, it will copy the package names to the clipboard:

      copy($$('[href^="/package/"]').map(a => a.textContent).join(' '))
      
  3. Save the list in a variable in your terminal:

    1. Type PACKAGES="
    2. Paste what the space-delimited list of packages you copied earlier
    3. Type " and press enter
  4. Add the new user as an owner

    1. Replace NEW with your new user’s name, and run this, it will show a preview:

      for PKG in $PACKAGES; do echo npm owner add NEW $PKG; done
      
    2. Run the same command you just run, but remove echo. This can take a couple of seconds for each package you have. Some packages might require an OTP if you use 2FA

🎉 Congratulations! You just added your new account as owner of your packages.

Now you can either delete your old npm account, or run that last command again replacing add NEW with remove OLD, where OLD is your old username.