Sfdx import failure ENOENT: no such file or directory
I'm trying to import data in a scratch org but I'm always getting the error
andresbrav-ltm2:sfdx-out local.user$ sfdx force:data:tree:import --targetusername test-user@example.com --plan export-demo-Broker__c-Property__c-plan.json ERROR running force:data:tree:import: ENOENT: no such file or directory, open '/Users/local.user/.local/share/sfdx/client/node_modules/salesforce-alm/schemas/dataImportPlanSchema.json'
I have generated the json data files and the json plan file with the sfdx export command, I have tried also with the files from the git repository for the trailhead course DreamHouse but it always tries to find this file .../dataImportPlanSchema.json that is not the plan file I'm sending.
Did anyone face this issue and know how to make the import command work with a plan to insert related tables? How do you resolve error Enoent No such file or directory?
This was a bug in 45.8.1. We fixed this in a patch, 45.8.2. https://developer.salesforce.com/media/salesforce-cli/releasenotes.html
Also, you do not need to run sfdx plugins: install salesforcedx@latest as the latest version of salesforce dx is already bundled with the cli. Just sfdx update is enough. I would recommend uninstalling salesforcedx as a user plugin and just using the one bundled with the CLI. To do so, just run sfdx plugins:uninstall salesforcedx. You only need to install it as a user plugin to pin to a specific version that isn't latest, see https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm# for more info.
To verify you are using the core salesforcedx version, you can run sfdx plugins --core and you will see the (core) next to salesforcedx.
Steps to fix error Enoent No such file or directory:
delete node-modules folder.
run command npm cache clean --force.
run command npm install.
install the package again with npm install your-package-name.