I'm working on "Unlocked Packages for Customers" trailhead module. While creating the package version I'm getting below error: ERROR: The --path (-d) value, [force-app], and --package (-p) value, [th-dreamhouse], were both found in sfdx-project.json but don’t match. If you supply both values, they must match the path and package values in one of the packageDirectories.

My sfdx command: sfdx force:package:version:create -p th-dreamhouse -d force-app -k test1234 --wait 10 -v DevHub

My sfdx-project.json file:

    "packageDirectories": [
            "path": "force-app",
            "default": true,
            "package": "dreamhouse",
            "versionName": "ver 1.0",
            "versionNumber": "1.0.0.NEXT"
            "path": "force-app",
            "package": "th-dreamhouse",
            "versionName": "ver 1.0",
            "versionNumber": "1.0.0.NEXT",
            "default": false
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "44.0",
    "packageAliases": {
        "dreamhouse": "0Ho0I000000PAscSAG",
        "dreamhouse@1.0.0-1": "04t0I000001E1xdQAC",
        "th-dreamhouse": "0Ho0I000000PAshSAG"

This error is occurring because you have two different packages using the force-app path. Since you're specifying both -d and -p in your command the path you provide for the -d flag has to match up with path for the package you provide with the -p flag. But your path is used for both dreamhouse and th-dreamhouse, so your path doesn't actually match up with the package provided.

Is there a reason you have force-app used for both packages? It seems like that's an error and if you either remove the dreamhouse package from your json file (if it's unnecessary) or set a different path for it then you should stop receiving that error.

|improve this answer|||||

Other solution that I test here: Duplicate directory force-app with other name how force-app-2

Try this command change directory. sfdx force:package:version:create -p th-dreamhouse -d force-app2 -k test1234 --wait 10 -v DevHub

Works for me, tks

|improve this answer|||||

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.