learn-co-curriculum / react-hooks-practice-animal-shelter

Other
3 stars 1.23k forks source link

rework lab and update dependencies #8

Closed codetombomb closed 1 year ago

codetombomb commented 1 year ago

Hello all! 👋

I re-worked the lab to update all dependencies and devDependencies.

Before reworking the lab, I tried to debug an issue that students were running into after running npm start. This was the error:

/Users/tomastobar/Development/code/phase-2/react-hooks-practice-animal-shelter/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

TypeError: Cannot read properties of undefined (reading 'toString')
    at /Users/tomastobar/Development/code/phase-2/react-hooks-practice-animal-shelter/node_modules/webpack/lib/cache/PackFileCacheStrategy.js:1223:37
    at async Promise.all (index 75)

I found that the following line at node_modules/webpack/lib/cache/PackFileCacheStrategy.js:1223 was causing the error:

pack.set(identifier, etag === null ? null : etag.toString(), data);

Where etag.toString() was causing the error.

Tried some things to try and fix this but could not find a solution.


What I did to fix this

Not sure if this is the best way to do these things (this is actually my first attempt at fixing a lab 😅) but I:

  1. Created a new React App
  2. Added all the same devDependencies and dependencies from the original repo
  3. Updatedindex.js file to satisfy the following warning:

Screenshot 2023-06-05 at 11 24 59 AM

  1. I completed lab to ensure it works and ran tests - this was ok.
Matt-Eva commented 1 year ago

Hey @codetombomb! Thanks so much for doing this! I was able to get it up and running as well.

It looks like we do need to update the scripts section in the package.json to reflect the original scripts included in the lab.