SFDX Push Error : An object 'ComponentName' of type LightningComponentBundle was named in package.xml, but was not found in zipped directory

 Hello,


Nowadays salesforce developers have moved to SFDX and VSCode as their primary IDE. There is one error which has particularly bothered me and my team. 

This error occurs when you create a new SFDX project and retrieve all the components, do all the required changes lets say in a lightning web component and try to push the component to salesforce org.

This error occurs : 

An object 'ComponentName' of type LightningComponentBundle was named in package.xml, but was not found in zipped directory.


Solution:

Please do check if there is meta.xml file in the component bundle, this error occurs because of missing meta.xml file. For some weird reason, the meta.xml file is not retrieved with the component.



If that is the case, then one solution is to create a meta.xml file manually under the component folder with the general XML configuration as below:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>49.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__HomePage</target>
        <target>lightning__RecordPage</target>
    </targets>
</LightningComponentBundle>

Below is how component bundle should look like:


This will resolve the issue.


Another solution will be to create a new component and copy-paste the code from the first component and use the newly created component in the salesforce org. But this is not an optimal solution.

Comments

  1. Great post Pritam!! I hope vs code developer should add it as feature in future

    ReplyDelete

Post a Comment

Popular posts from this blog

Salesforce Apex Triggers Interview Questions/Scenarios