Search code examples
jestjsyarnpkgwindows-subsystem-for-linux

Jest error: cannot parse package.json as JSON: Unexpected end of JSON input


I just installed jest globally using yarn in WSL2, however when I tested, it gave me this error, can anybody tell me how to fix this? error

These are the steps that I followed when was installing it:

yarn global bin

yarn config set prefix ~/.yarn

Next, I added:

export PATH="$PATH:`yarn global bin`"

to ~/.bashrc

yarn global add jest

Solution

    • I just solved this error by adding the {} bracket to the package.json and it work. Thank you everyone for checking out my question.