0

I am trying to build a website using create react app and bootstrap. We are hosting the site via GH-pages and our repository is here. I have not had issues deploying the site locally until today, but have not yet been able to solve the problem after many hours.

I will go through the steps I performed to get me to where I am at.

  1. Cloned repository through GH Desktop
  2. Opened terminal and input brew reinstall node
  3. Moved to project directory and input npm install react-bootstrap bootstrap@4.6.0 and npm install
  4. Finally input npm start

I was met by this:

Command Line response to npm start while in project folder

When I look in '.../node_modules/immer/dist', I see it contains 'immer.d.ts'. Further, when I look in '.../node_modules/react-dev-utils', 'immer.js' is present. I do not know much about Typescript, but the "main" entry looks like it is present, and the files are all present:

immer in node_modules

immer in react-dev-utils

I have uninstalled and reinstalled the package manager, repository all day. I even reset my terminal and text editor to test it on a fresh reboot. I have gone through many StackOverflow questions and done things such as removing only the node_modules and package_lock.json files then inputting npm install, with no success.

Does anyone know what is missing? What should I do?

UPDATE The problem with the 'immer' file was fixed by following the steps provided in the response: clearing the cache, updating the repository, getting a fresh clone, removing the damaged files, and installing npm.

After following these steps, the terminal returned this issue. I have tried troubleshooting this one as well, but feel like I am going in circles. Any directed advice helps.

Error returned after fixing the last one

C RICH
  • 165
  • 9

2 Answers2

0

First and foremost: exclude your node_modules file from git index. There is an entry in .gitignore to exclude it but it looks like you've included node_modules in index before adding that entry. Now you need to run a bit more sophisticated algorithm to get rid of it.

Quick troubleshooting for your problem (a bit redundant to my taste but just to make sure you didn't miss anything important):

# force cleaning npm cache. you may have a broken package there
npm cache clean --force 

# clone repository into newly created directory (guaranteed to be clean)
git clone https://github.com/cameron-keene/ACE_Website somedir

# switch to the new directory
cd somedir

# remove broken node_modules
rm -rf node_modules

# remove (possibly) broken package-lock
rm package-lock.json

# fresh dependency install
npm install

Right now it looks like your immer dependency stored in node_modules is broken. As it has a lot of missing files and dist/immer.js is one of. That's why you're getting your error.

aleksxor
  • 7,535
  • 1
  • 22
  • 27
  • Thank you for your response. I am happy I asked this question, you got me to learn about the git index. I went through the steps you suggested: first following the [algorithm](https://sebhastian.com/git-ignore-node_modules/), then following your set of steps. After all of this, it looks like the 'immer' file has been fixed, but now the terminal is throwing another problem. I have added it to this problem as an update. I hope you can help. – C RICH Jun 03 '21 at 00:37
0

This problem was solved with

npm install --legacy-peer-deps

Shoutout to this Stack Overflow answer

C RICH
  • 165
  • 9