Why do I need this file and why do I need to install jquery packages with yarn or npm

I don't think you do. I may be wrong though.



I will answer your question in the last paragraph but wanted to say

I've been following your posts and a lot of your questions can be
answered with really simple Google searches...that skill is a far more
valuable means you can learn new things and get up to speed
quickly and independently. Rather than running to this list every time
you hit an issue, try to do basic google searches first...if you fail to
find the answer (you likely won't) -- THEN ask here.

Anyways -- the answer is that a package.json file exists for npm to
handle might need them if your asset pipeline uses
something like webpack (it really should)...

Also, to add on:

The reason you'd install jquery this way is that you don't have to track
it in git -- so the source tree becomes less's a much
cleaner way to handle assets. Bower was kinda-sorta deprecated in favor
of using yarn. Yarn is super nice to work with and has some caching