I've worked on developing ligthing component using sfdx and till some point everything worked fine. Today I got latest changes from my git repo and tried to make sfdx force:source:push but it failed with a message Unexpected file found in package directory: path_to_my_source\force-app\main\default\classes\MyCustomApex.cls. I spent some time investigating this but at some point of time I decided to start from the scratch but still got the same exception. Here is what I did:

  1. Cloned my repository to the new folder
  2. Authorzied in DevHub trial using sfdx force:auth:web:login -a DevHub -d -s
  3. Created new scratch org using sfdx force:org:create -a MyNewOrg -s -f config/project-scratch-def.json
  4. Installed Lightning Test Service using sfdx force:lightning:test:install

Now I try to push my cloned sources into the scratch org using sfdx force:source:push but keep getting this error. I tried to checkout the version that for sure had only my code and worked for me but the error remained. Am I doing something wrong? Did I miss anything?

  • Could another developer have checked in that file without its meta-xml file? – David Reed Feb 14 '18 at 13:44
  • No, it seems that MyCustomApexcls-meta.xml is there. Also there were no changes to this file, and furthermore, other devs in my team don't have this kind of problem – Demarsch Feb 14 '18 at 19:06

Still don't know the root cause, but reinstallation of SFDX CLI helped (no changes of the source code)

  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – SF_user Feb 15 '18 at 9:39
  • 1
    You want me to request clarification from myself? – Demarsch Feb 15 '18 at 11:13
  • Does not work for me. I have slight different error: ERROR: Unexpected file found in package directory: /**/src/dashboards/Power_Router_Dashboards-meta.xml. – devilpreet Dec 26 '18 at 5:08

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.