[SalesForce] DeployFailed: Deploy failed. Visual studio code – Deploy to source code failed – SFDX Lightning Component Trailblazer

I tried to do the trailhead module "Create a Hello World Lightning Web Component" and I followed all the steps but when I do deploy to source to org, it fails. The error which I get is: "DeployFailed: Deploy failed."

It might seem duplicate but I tried all possible answers I found. The API version of my target org is 45.0 and the sfdx extension has also version 45.0. Initially my sfdx cli version was 46.0 and it was throwing api version not found error. I have changed that to version 45.0 using –
"sfdx force:config:set apiVersion=45.0 " command . Now I am getting the above mentioned error.
No other information is available.

Best Answer

Worth a shot: try deploying via the CLI rather than VS Code to get better error messaging. cd to your project directory and run the following command:

sfdx force:source:deploy --sourcepath \force-app

In my case this told me "Can't create lightning component bundle if there is already an aura definition bundle with the same name and namespace." I just had to delete the "helloWorld" aura component and then deploying the LWC worked. Hope this helps!