Plugin does not able to locate export.json in the "working directory".


Question.

I followed the instructions and make the following export.json:

{ "objects": [ { "query": "SELECT Id, Name FROM Account", "operation": "Upsert", "externalId": "Name" } ] }

I saved it in ./scripts Then I installed sfdmu, which ended seemingly well and then I ran:

$ sfdx sfdmu:run -sourceusername source -targetusername target -p ./scripts

And I got the error:

$ sfdx sfdmu:run -sourceusername source -targetusername target -p ./scripts
Execution of the command sfdmu:run has been started. 
Command in progress ...... done 
[ERROR] Command initialization error: Missing package.json file in the working directory.. 
Execution of the command sfdmu:run has been finished. Exit code 2 (COMMAND_INITIALIZATION_ERROR). 
Total time elapsed: 00h 00m 00s 005ms .

How to resolve?


Answer.

There are several possible reasons of this issue:

  • You have to enclose the path into double quotes (--path "./scripts")
  • The correct syntax is: -p="./scripts" or --path "./script"
  • For MacOS machines add sudo before the command. For Windows machines your don't have.

Below is the command which should work for you:

$ sudo sfdx sfdmu:run --sourceusername source --targetusername target --path "./scripts"
Last updated on 17th May 2023