I've this error when I tried to create a lightning web component also lwc wasn't updated automatically in force-app/main/default . I had to put it manually on it

Could you advice what's wrong?

  • 2
    Did you update the sfdx cli to the prerelease version using sfdx plugins:install salesforcedx@pre-release ? – Fabien Taillon Dec 19 '18 at 8:34
  • Yes and still can't create a component – Mayar Ahmed Dec 19 '18 at 10:17
  • And when you do a "sfdx force:lightning:component:create -h", do you see doc for lwc ? – Fabien Taillon Dec 19 '18 at 10:24
  • Thanks the error was that I didn't run this command inside lwc folder could you advice where is this command ? as per trailhead it was just ctrl+shift+p and choose creating components and this didn't go well with me – Mayar Ahmed Dec 19 '18 at 10:39
  • You can run this command directly from terminal, but good to know that you find a way to make it work, even though it should work even from another folder. – Fabien Taillon Dec 19 '18 at 10:46

I experience this problem whenever I have not authorized my project to a pre-release instance of Salesforce that has Dev Hub enabled.

If you open VS Code, and simply try SFDC: Create Lightning Web Component, you'll get the error Mayar referenced.

However, the Trailhead module prompts you to do a few steps first: Create your project, authorize it to a Dev Hub, create a scratch org and then create the component. Once I did those steps in the order listed in the Trailhead module, I had no issues.


running this worked for me:

sfdx force:lightning:component:create -n helloWorld --type lwc -d force-app/main/default/lwc


If anyone not getting the option 'force-app/main/default/lwc' while creating a Lighting Web Component in Microsoft Visual Code. you can execute the following command via CLI: it worked for me.

sfdx force:lightning:component:create --type lwc -n helloWorld -d force-app/main/default/lwc

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.