I'm trying to deploy an sfdx project to my production org, and this is my first attempt to not use the 'convert to traditional packages with mdapi' route.

I created my sfdx project via cli, pulled metadata from production using mdapi, converted it, pushed to a scratch, made changes in scratch, pulled changes back into project, tested everything... and now I'm ready to deploy:

sfdx force:package:Create --name "emailStatusUpdate" --packagetype Unlocked --path ./

[RESPONSE]: Successfully created a package. 0Ho360000004CAkCAM

To deploy (ie 'install') the package with force:package:install I need to create a version of the package first:

sfdx force:package:version:create --package "emailStatusUpdate" -d ./ -x

[RESPONSE]: Unexpected file found in package directory: P:\emailStatus\sfdx-project.json.

Why is that file unexpected? Hell, it's the only thing that was changed by my package creation command. No files were added, no packages created in my Production org (set as dev hub).. only my sfdx-project.json was updated with the package details.

And when I try to create a second package for the same project in a new directory, things start getting screwy:

PS P:\emailStatus> sfdx force:package:create --name "test3" --packagetype unlocked --path P:/testdir
ERROR:  Maximum call stack size exceeded.
PS P:\emailStatus> sfdx force:package:create --name "test3" --packagetype unlocked --path P:/testdir
ERROR:  The package name must be unique for the namespace.

No 'testdir' was created, nor was the sfdx-project.json updated with the new package info... and yet:

PS P:\emailStatus> sfdx force:package:list
=== Packages [3]
NAMESPACE PREFIX  NAME                    ID                  ALIAS              DESCRIPTION               TYPE
────────────────  ──────────────────────  ──────────────────  ─────────────────  ────────────────────────  ────────
                  emailStatusUpdate       0Ho360000004CAkCAM  emailStatusUpdate  Case Email Status Update  Unlocked
                  emailStatusUpdateTest2  0Ho360000004CApCAM                     Case Email Status Update  Unlocked
                  test3                   0Ho360000004CAuCAM                                               Unlocked

Anyone know what I'm missing to successfully deploy? Having a real difficult time finding resources that walk you through this process.

1 Answer 1


Your command is using the wrong value for the -d parameter. It should be the folder that your metadata is in, not the top-level project folder.

For example, if you create a new project in P:\emailStatus, the create project command will add P:\emailStatus\force-app by default where all of your metadata is stored. If you want to create a package version from that, you would use sfdx force:package:version:create --package "emailStatusUpdate" -d force-app -x.

If you have your metadata in a different folder (e.g., P:\emailStatus\core) you would pass that folder name instead.

I've found this reference to be helpful for understanding the package flow. It gives the order of the commands with examples.

  • That's a helpful link, thanks! However, when I get to the force:package:version:create step, I get an ERROR: Cannot read property 'split' of undefined. Any idea what might cause that?
    – smohyee
    Aug 17, 2018 at 13:40
  • Separately.. I have three packages I've created on this project while testing functionality, that all show up in force:package:list... is there a way to remove these packages if I want to start over to make sure they aren't causing the issue?
    – smohyee
    Aug 17, 2018 at 13:41
  • 1
    As far as I know it is not currently possible to delete a package or package version - there's nothing in the cli reference that indicates that's possible. As for your other issue - could you post the directory structure for your project and the exact command you're running? Aug 17, 2018 at 21:31

You must log in to answer this question.

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