4

Error when creating new version of unlocked package.

An error occurred while trying to install a package dependency,ID 04XXX: Missing Organization Feature: Knowledge

sfdx-project-json

        "path": "force-app",
        "default": true,
        "package": "memberone",
        "versionName": "July 22 2019",
        "versionNumber": "0.2.11.NEXT",
        "definitionFile": "config/project-scratch-def.json",
        "dependencies": [...

config/project-scratch-def.json

    {
"orgName": "MemberOne",
"edition": "Enterprise",
"features": ["Communities", "Sites", "Knowledge"],
"settings" : {
    "orgPreferenceSettings": {
        "chatterEnabled": true,
        "s1DesktopEnabled": true,
        "networksEnabled": true,
        "knowledgeEnabled": true
},
    "knowledgeSettings":{
        "enableKnowledge": true,
        "enableLightningKnowledge": true,
        "
    }
}

}

When I use the scratch-def to create scratch org directly it seems to work fine and dependent package 04XX installs.

1
  • 1
    I'm getting a similar error for AccountTeamMember. If you happen to find out before me, please @ notify me with a comment. I'll add an answer if I figure it out first.
    – sfdcfox
    Jul 22, 2019 at 18:14

2 Answers 2

0

The force:package:version:create command takes a definition file as an optional argument, where you can specify the required dependencies:

-f | --definitionfile DEFINITIONFILE
Optional
The path to a definition file similar to scratch org definition file that
contains the list of features and org preferences that the metadata of the
package version depends on.

Despite the phrasing "similar to", as far as I know it's exactly the same as your project's standard scratch org configuration file, as illustrated in Generate a Package Version.

That sets the shape of the under-the-hood scratch org used to build the package version.

3
  • Yeah, my fault in post for not indicating this was only partial file. Edited to include whole file. Exact same file we use to create the scratch org which did successfully twice today, including with Knowledge and the installed dependent package.
    – ddeve
    Jul 22, 2019 at 18:46
  • 1
    @user2451 Did you explicitly specify -f config/project-scratch-def.json when you issued the version create command? (I understand you're doing that when building your dev scratch orgs)
    – David Reed
    Jul 22, 2019 at 18:49
  • 2
    In the end worked on another machine when including the -f setting for scratch config file which seems like should not be needed if definitionfile is included in package.json? Redundant. I had not been including that initially. DX seemed flaky though as I tried this when suggested at work and still got errors. @sfdcfox
    – ddeve
    Jul 23, 2019 at 1:07
0

My issue was Missing Organization Feature: B2C. This means Person Accounts is not enabled in your org. I added PersonAccounts to my features list in the scratch org config, created a new org, and was able to install.

My complete config/project-scratch-def-json file:

{
  "orgName": "Foo",
  "edition": "Developer",
  "features": [
    "ServiceCloud",
    "HealthCloudUser",
    "Knowledge",
    "MarketingUser",
    "EventLogFile",
    "Communities",
    "ContactsToMultipleAccounts",
    "DebugApex",
    "FieldAuditTrail",
    "FieldService",
    "LiveAgent",
    "LiveMessage",
    "PersonAccounts",
    "RecordTypes"
  ],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true
    }

You must log in to answer this question.

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