Plugin cannot locate export.json in working directory.


Question

I followed the setup instructions and created the following export.json:

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

I saved it in ./scripts, installed SFDMU successfully, and then ran:

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

I received this error:

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 can I resolve this?


Answer

The error might be due to incorrect path specification. Ensure the path to the scripts directory is correctly formatted in the command. Here's how you can modify it:

For Windows:

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

For MacOS, prepend sudo if required:

$ sudo sfdx sfdmu:run --sourceusername source --targetusername target --path "./scripts"
Last updated on 20th Apr 2024