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

1.1k views Asked by At

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
1

There are 1 answers

1
Son Minh Nguyen On BEST ANSWER
  • I just solved this error by adding the {} bracket to the package.json and it work. Thank you everyone for checking out my question.