Npm command not found when working with jest in LWC
I am doing this trailhead module to get started with testing in LWC. The first step is to run below command sfdx force:lightning:lwc:test:setup But when I run this in terminal, I am getting a below error. ERROR running force:lightning:lwc:test:setup: npm command not found. Verify npm is properly installed and try again. I have verified npm is installed in my system, below is the screenshot.
as an alternate I downloaded jest library from git but now not sure how to use this library in my current project so that I can run the next command node node_modules/@salesforce/sfdx-lwc-jest/bin/sfdx-lwc-jest Can someone please suggest this, I have tried the same thing in different machines and all of them are failing with the same error.
i faced the same problem npm: command not found in my code. Try following , it worked for me. npm install @salesforce/sfdx-lwc-jest --save-dev