0

Help me to fix this error

'SFDX: Deploy This Source to Org' resulted in an error (c:\force-\main\default\classes\ChangePasswordController.cls: Metadata xml file missing for 'LightningComponentBundle')

enter image description here

2
  • can you add a screenshot of an error you are facing? Also what components are you trying to deploy? – Rahul Gawale Sep 13 '20 at 12:46
  • I think you need to deploy the class first, then lwc or deploy them together using sfdx command. – Rahul Gawale Sep 14 '20 at 7:22
1

The error means you're missing a metadata file. On the file explorer, click on the New File button, and name it:

ChangePasswordController.cls-meta.xml

And give it the following contents:

<?xml version="1.0" encoding="UTF-8'?>
<ApexClass xmlns="http://soap.sforce.com/2006/04">
  <apiVersion>49.0</apiVersion>
  <status>active</status>
</ApexClass>

Save, then deploy your class again.

Odds are, the file may have been accidentally deleted or you forgot to create this file. When creating a new Apex Class in VS Code, you should use the SFDX: Create Apex Class command option (right-click on the classes folder to find this menu item), instead of manually creating the file.

New Apex Class

1
  • Thanks, but I'm having meta file for that class, even I have meta file for all the apex classes, but when I try to deploy the changes from VS code, I'm getting this error. Also, in the error it was mentioned like "Metadata xml file missing for 'LightningComponentBundle" not sure about this error. – Parthiban Sep 13 '20 at 13:56
0

The easiest solution is to create a new Apex Class via VS Code as per sfdcdox's answer above, then copy the contents of your file 'LightningComponentBundle' into it. Delete the original from Project and Org and then rename your new class as needed.

Alternatively you can create the class via the developer console in your org and then retrieve the metadata as normal in VS Code.

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.