[SalesForce] How to create a managed package with SFDX

I am trying to create a managed package using SFDX CLI.

I am executing a command

sfdx force:package:create -n name -t Managed -r force-app

but receiving an error

ERROR: You must specify a namespace for this package.

When I change sfdx-project.json to include namespace, I receive another error

$ sfdx force:package:create -n name -t Managed -r force-app

ERROR: The specified namespace is not owned by the dev hub.

I don't understand this error message.

How do I own specified namespace by Dev Hub?

Best Answer

Ok, looks like I have to create Developer Edition org and register a namespace there and then link it to my Dev Hub org due to documentation

https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_reg_namespace.htm

Related Topic