10

I have created an Unlocked Package in my DevHub using force:package:create and installed it in a scratch org for testing. Now I can't seem to find a way to remove it. I really don't want it showing up on force:package:list because it was created for testing purposes only.

3 Answers 3

3

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

1
  • 1
    Everyone upvote this! It is a no-brainer and annoying to have all the clutter. Commented Mar 15, 2019 at 20:34
2

Tangentially related topic: This can get pretty annoying if you have to deal with package creation in Trailhead modules and try to redo steps to create the specifically named packages.

In that case you can at least rename old ones to clear the way with:

sfdx force:package:update -n <newname> -d <newdescription> -p <package-(alias or id)>
0

You can follow the next steps to delete an Unlocked Package from a Salesforce Dev Hub using the Salesforce CLI. To delete a package or package version, users need the Delete Second-Generation Packages user permission. Before you delete a package, first delete all associated package versions.

Authenticate with Your Dev Hub Org:

sf org login web --set-default-dev-hub --alias DevHubAlias

Replace DevHubAlias with an alias for your Dev Hub org.

List all Package Versions in your Dev Hub org:

sf package version list --target-dev-hub DevHubAlias

Replace DevHubAlias with an alias for your Dev Hub org.

Delete the Package Version:

sf package version delete --package PackageVersionID --target-dev-hub DevHubAlias

Replace PackageVersionID with the ID (starts with 04t) or alias of the package version you want to delete, and DevHubAlias with the alias of your Dev Hub org. Confirm the deletion when prompted.

List Installed Packages along with their IDs:

sf package installed list --target-org OrgAlias

Replace OrgAlias with a username or alias of the target org.

Delete the Package:

sf package delete --package PackageID --target-dev-hub DevHubAlias

Replace PackageID with the ID (starts with 0Ho) or alias of the package you want to delete, and DevHubAlias with the alias of your Dev Hub org. Confirm the deletion when prompted.

You must log in to answer this question.

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