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
    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 at 18:14
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.

  • 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. – user2451 Jul 22 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 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 – user2451 Jul 23 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.