command not found: jest
Solution 1:
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.
Solution 2:
You need to run it this way :
./node_modules/.bin/jest
or run npm test
Solution 3:
I ran into similar issue. I fixed it by installing jest globally.
npm install -g jest