I am trying to perform this(https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components/create-a-hello-world-lightning-web-component) with VS code and it is throwing following error. A required metadata folder named "lwc" does not exist in this workspace.

Performed following steps.

  • Installed lightning web component plugin in VS code.
  • Created a new SFDX project.
  • Error while running SFDX: Create Lightning Web Component.

For now, you need to have the pre-release version installed for DX:

sfdx plugins:install salesforcedx@pre-release

Make sure you've also updated all extensions, including Lightning Web Components, which is not currently part of the Salesforce Extension Pack.

Often, simply restarting after installing/updating all extensions and the pre-release sfdx plugin will automatically create the lwc folder for you. You may also need to close and re-open the folder for it to take effect. I'm not sure how/why my lwc folder appeared, but it wasn't obvious as to what I did.

If all else fails, create a new project in a new, empty directory, and copy the lwc folder back into force-app/main/default/, so that it has two files:


Once you've done that, you'll stop getting that error and be able to create new components. These config files may require modification if you copy from a new project, so make sure you check the file paths of jsconfig.json. Every time you create a new component with sfdx, jsconfig.json will be updated with more metadata, so make sure you commit this file if you're using a repo.

NOTE: Even though you'll be able to create files locally, to push to the server, you need a pre-release org for now, since all new LWC features are tied to API 45.0 and later, while all production and scratch orgs will be 44.0.

  • Thanks. I think the above two files will automatically create when one could create lwc. No need to create them explicitly. Dec 31 '18 at 22:55
  • @AnuragBhardwaj They are supposed to be created, yes, but there was a bug back around when this question was asked (or, at least, it didn't work for me the first time). This is more of a "what happens when things go wrong" answer.
    – sfdcfox
    Dec 31 '18 at 22:58

You Just need to update the sfdx cli(global) Version : --> sfdx update and update all extensions, including Lightning Web Components and Salesforce Extension Pack. Close the visual code editor,Reopen it and try to create a new project it will automatically create the Lwc folder for you.

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.