Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete an npm package from the npm registry?

Is there a possible way to remove or delete the entire module from npm registry?

Notice: npm -f unpublish doesn't allowed you to unpublish anything older than 24 hours

like image 891
KhaledMohamedP Avatar asked Apr 29 '16 01:04

KhaledMohamedP


People also ask

How do I completely uninstall npm?

To completely uninstall node + npm is to do the following: go to /usr/local/lib and delete any node and node_modules. go to /usr/local/include and delete any node and node_modules directory. if you installed with brew install node, then run brew uninstall node in your terminal.

How do I uninstall all npm global packages?

If you would like to remove all the packages that you have installed, you can use the npm -g ls command to find them, and then npm -g rm to remove them.


2 Answers

There's a post about that, given the recent incident. Your best bet would be to contact npm and hope that your package isn't depended by other projects.

If the version is older than 24 hours, then the unpublish will fail, with a message to contact [email protected].

If you contact support, they will check to see if removing that version of your package would break any other installs. If so, we will not remove it. You’ll either have to transfer ownership of the package or reach out to the owners of dependent packages to change their dependency.

http://blog.npmjs.org/post/141905368000/changes-to-npms-unpublish-policy

like image 91
Joseph Avatar answered Oct 02 '22 15:10

Joseph


TL;DR:

npx force-unpublish package-name 'reason message' 

Explanation:

It uses the cli tool force-unpublish which takes the following steps:

  1. npm deprecate package-name 'reason message'
  2. npm owner add npm package-name
  3. npm owner rm $(npm whoami) package-name

https://www.npmjs.com/package/force-unpublish

like image 39
cc2937 Avatar answered Oct 02 '22 15:10

cc2937