command not found: jest

Install the Jest command-line interface (Jest CLI):

npm install --save-dev jest-cli

Then run the jest command. Working for me in a linux instance by docker on Windows 10.


Jest is installed, but is likely in your ./node_modules/.bin directory. You can append that to your command ./node_modules/.bin/jest --updateSnapshot. Since you already have jest as a scripts command in your package.json you can also run it with npm test -- --updateSnapshot. npm automatically adds ./node_modules/.bin to your path.

update: Newer versions of yarn will resolve node module bin scripts, so you can also just run yarn jest {cmd} and it should work.


I ran into similar issue. I fixed it by installing jest globally.

npm install -g jest

You need to run it this way :

./node_modules/.bin/jest

or run npm test