DEV Community

Rossano D'Angelo
Rossano D'Angelo

Posted on

My personal business card - What's next?

What's next?

Now that the package is up and running, I'd like to change it a bit. I'd like to change the name, for example. Something like npx rossanodan would be far better!

I also noted the README is wrong!!!

How to rename a published npm package

Honestly, I don't have a clue about how to rename a npm package so I searched on Google and I found this

In simple words no you can't. But npm provides you a different solution called npm deprecate.
What it does is it marks a particular version or version ranges of that package as deprecated. So next if someone tries to install this package they get a warning package deprecated along with your custom message, in which you can easily specify your new package name.
npm deprecate my-package-name@"< latest-version" "your message"
Your message can be any thing like:
WARNING: This project has been renamed to your-new-package-name. Install using new-package-name instead.

So I run

npm deprecate rossanodan-card@"< 1.1.0" "This project has been renamed to rossanodan. Install using npx rossanodan instead."

Alt Text

I want to check the deprecation, so I run

npm uninstall rossanodan-card
npx rossanodan-card
Enter fullscreen mode Exit fullscreen mode

Nothing changed, it works like before.


Things get interesting. Since no one should depends on my package, I dediced to unpublish it.

I export the NPM_TOKEN once again (I didn't save it into my bash_profile)

export NPM_TOKEN=XXXXXXXXXXXXXXXXXX // use your token here
Enter fullscreen mode Exit fullscreen mode

I had an authentication issue.. I need to login again! I run npm adduser and this prompts

Email: (this IS public) YOUR NPM EMAIL

// If everything is correct

Logged in as YOUR USERNAME on
Enter fullscreen mode Exit fullscreen mode

It's time to unpublish

npm unpublish rossanodan-card --force
Enter fullscreen mode Exit fullscreen mode

The packages section is now empty, hurray!!! Now i can create a new npm package with the new name.

I will reuse the same repository, I don't need creating a new one. It's enough reworking the package.json and editing the information I want to change.

All done

The new package is available at

Alt Text

Top comments (0)