2

When attempting to list packages for a sandbox (Which is connected to a production org with devhub enabled and unlocked packages enabled) I get the following error:

Packaging is not enabled on this org. Verify that you are authenticated to the desired org and try again. Otherwise, contact Salesforce Customer Support for more information.

This is a new sandbox that was created after the devhub and unlocked packges were enabled. I can get a list of packages from a trailhead DE or from production, but not from sandboxes.

The command I am running is

sfdx force:package:list -v sandboxname

sandboxname is authenticated and connected. Any ideas?

3 Answers 3

6

sfdx force:package:list requires a dev hub. If you want to list packages in another type of org what you want is sfdx force:package:installed:list.

3

Sandboxes cannot be Dev Hubs or own packages. To enable Dev Hub, you must be in your

Developer Edition, trial, or production org (if you’re a customer), or your business org (if you’re an ISV).

Sandboxes' refresh cycles are not compatible with being the owner of a package and its associated version artifacts, which are expected to have an arbitrarily long lifespan. That's why those artifacts have to be owned by some species of production org. Further, your scratch org allocations and package version limits are tied to your production org.

(Similarly, you can't enable Environment Hub in a sandbox).

0
0

I had same error running sfdx force:package:version:create
The solution was to enable packaging permission in my user's profile:
System Permissions -> Create and Update Second-Generation Packages

See documentation here: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_setup_add_users.htm#sfdx_setup_permission_set.xml

You must log in to answer this question.