1

All was working fine till the morning untill, in the afternoon when i tried to run some create LWC commands. Now, no SFDX commands will work, i am getting the following error :

04:30:38.633 sfdx force:lightning:component:create --componentname myComponent2 --outputdir force-app/main/default/aura
ERROR running force:lightning:component:create:  Command failed with ENOENT: npm root -g --prefix /Users/padmajasubhash/Documents/SFDX Projects/Surya Practice/.yo-repository --loglevel error
spawnSync npm ENOENT
04:30:39.881 sfdx force:lightning:component:create --componentname myComponent2 --outputdir force-app/main/default/aura
 ended with exit code 1

Please help.

6
  • Could you run sfdx update to see if it fixes this. May 4 '20 at 3:58
  • Try restarting your computer. That tends to fix this error.
    – sfdcfox
    May 4 '20 at 4:24
  • @sfdcfox : Tried that, still not working.
    – Surya
    May 4 '20 at 5:32
  • @MohithShrivastava : Already upto date
    – Surya
    May 4 '20 at 5:33
  • It seems like the project wasn't generated properly. Try creating an empty .yo-repository folder in /Users/padmajasubhash/Documents/SFDX Projects/Surya Practice. That might fix it, though it doesn't fix the initial problem
    – nchursin
    May 4 '20 at 7:37
5

Please visit- https://nodejs.org/en/download/ and install node.js on your machine. This is not a vs code extension. Restart VS code after install.

1
  • Yup, don't know why but this started working fine after i installed node js. It used to work fine before. Well, anyway, it works now.
    – Surya
    May 22 '20 at 9:57

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.