8

In the documentation, there is a command sfdx force:package:create. This works. If I then issue the command sfdx force:package:list, it perfectly shows the package I just created. Now the question is, how do i delete this package? I just created this package for testing, it doesn't have any use or meaning at all. I tried force:package:destroy, force:package:delete, force:package:remove, just to try if there are hidden commands out there to do this task, but it doesn't work.

4 Answers 4

5

These are the all available package command which we have right now. package Commands.

As of now, we don't have any command which can do this task so you need to manually delete the package from UI. Also the sfdx force:package:create is still in beta so SF might give this command in future but as of now, There is no option available.

11
  • 1
    hello @tushar-sharma. if UI is the only way right now, would you be kind enough to point me to the right direction on how to do that. I logged in to my trial devhub org and in the UI, i can only see scratch org infos. I cant find the created package infos.
    – SamuelDev
    Commented Aug 22, 2018 at 6:28
  • @SamuelDev you delete a package from an org in which you have installed it.
    – Eduard
    Commented Aug 22, 2018 at 7:17
  • @SamuelDev Please check the package in scratch org. Commented Aug 22, 2018 at 7:33
  • 1
    Hello @Eduard . If you are referring to the org where i installed the package (in this scenario, that would be my trailhead playground org), and then in the quick find box, typing "installed packages", and then inside the installed packages page, uninstalling the package, and further deleting the uninstalled package, yup i have already done that. However, when i run the command force:package:list, the package still exists. The package is already uninstalled and deleted in the destination org. but it is not yet deleted in the DevHub.
    – SamuelDev
    Commented Aug 22, 2018 at 7:34
  • 1
    Uninstalling a package version is not the same as "removing" / "deleting" the package. Please do not confuse. Currently, there is no way to delete a package. Commented Oct 22, 2018 at 17:40
10

It cannot currently be done by you. Perhaps Salesforce support could do it if you contacted them.

You can uninstall the package from various orgs as suggested by the previous answer. That does not eliminate the package from your package list.

sfdx force:package:list

... will still show the package even if it is uninstalled from all orgs.

I have created an idea to add this capability to the SFDX cli on the idea exchange. Go vote for it. https://success.salesforce.com/ideaView?id=0873A000000lMYmQAM

2
  • 1
    This is the correct answer. The answer by @Tushar Sharma misunderstood the question and confused uninstalling a package version with the request to delete a package. Commented Oct 22, 2018 at 17:41
  • Agreed 100%. Trailhead beta isn't super useful.
    – Shanerk
    Commented Dec 5, 2018 at 15:12
4

Winter '21 release enables package and version deletion:

sfdx force:package:version:delete

sfdx force:package:delete

Do take into account that deleted packages or package versions can’t be recovered, or specified as a dependency, and any new installations of the package will fail.

Released versions of second-generation managed packages can’t be deleted.

More details here.

1

Now, we can delete: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp_package_deletion.htm

Considerations for Deleting a Package or Package Version

Deletion is permanent. Attempts to install a deleted package version will fail. Before deleting, ensure that the package or package version isn’t referenced as a dependency. Examples:

$ sfdx force:package:delete -p "Your Package Alias"

$ sfdx force:package:delete -p 0Ho...

$ sfdx force:package:version:delete -p "Your Package Version Alias"

$ sfdx force:package:version:delete -p 04t...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .