[SalesForce] Error running sfdx force:package:version:create

I get an error when I'm trying to create a package version.
This is the command which I'm running:

sfdx force:package:version:create -p assured-pkg4 -d force-app -k 12345 --wait 10 -v DevHub

And this is the error that I get:

ERROR running force:package:version:create: oliver: Not available for deploy for this organization,oliver: Communities must be enabled before deploying a Chatter Network Site,oliver_C: You don't have the correct site publisher privileges for this operation Site : oliver, type: Site.com Community(db=C,api=ChatterNetworkPicasso)

Oliver is the community name. DevHub user is an admin user on salesforce prod, it should have permission to deploy communities. I'm also able to push all metadata on a scratch org.

This is my sfdx-project.json file content:

{
    "packageDirectories": [
        {
            "path": "force-app",
            "default": true,
            "package": "assured-pkg4",
            "versionName": "ver 1.0",
            "versionNumber": "1.0.0.NEXT"
        }
    ],
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "46.0",
    "packageAliases": {
        "assured-pkg4": "0Ho6F000000Gmm0SAC"
    }
} 

If you have any clue I will appreciate.

Best Answer

Package version creation takes place in a scratch org, whose configuration must meet the minimum requirements for your package's metadata in order for it to be deployed there.

You can specify a scratch org definition to the force:package:version:create command with the -f argument. You'd do something like this:

sfdx force:package:version:create -p assured-pkg4 -d force-app -k 12345 --wait 10 -v DevHub -f config/project-scratch-def.json

Then, the version creation org will have the same configuration as your project's regular scratch orgs, allowing your source to be deployed there.

Further Packaging Issues

The Network and Community metadata entities are not packageable in first or second-generation packaging. You will not be able to include them in your package version. See the Metadata Coverage Report.

Related Topic