Date fns node modules not installing index.js file when running yarn

System Information
  • Strapi Version: 4.17.0
  • Operating System: macOS Sonoma 14.3.1
  • Database: sqlite
  • Node Version: 20.11.1
  • NPM Version: 10.2.4
  • Yarn Version: 1.22.21

I’m trying to install a Strapi project that I’ve made a few months back on my new laptop and I keep getting the error:
Error: Cannot find module '/ppl-cms/node_modules/date-fns/index.js'. Please verify that the package.json has a valid "main" entry

I’ve tried using different node versions, deleting node_modules and yarn.lock files and updating strapi but nothing seems to work. Can’t seem to find that much information online about this topic so I was hoping to find some help here. The date-fns version that is being isntalled is 2.30.0. I’ve read about this problem in some previous versions but not in this one. Any advice?