'Failed to update react-scripts

I have a react application that was created with create-react-app and is using react-scripts version 3.4.2. The app works great but when I run eslint against it I get many invalid no-unused-vars errors. By invalid I mean that when I go to the file that variable is actually being used.

Based on this answer it seems the issue is related to @typescript-eslint/parser and @typescript-eslint/eslint-plugin. So I went ahead and executed npm list @typescript-eslint/parser @typescript-eslint/eslint-plugin on my app and this is what I get:

[email protected] /Users/diego/myapp/client
└─┬ [email protected]
  ├─┬ @typescript-eslint/[email protected]
  │ └── @typescript-eslint/[email protected] deduped
  ├── @typescript-eslint/[email protected]
  └─┬ [email protected]
    ├── @typescript-eslint/[email protected] deduped
    └── @typescript-eslint/[email protected] deduped

As seen all occurrences of the two potentially conflictive libraries are included by react-scripts app and that is why I am trying to update it.

I tried updating to 4.0.3 and when I do that eslint starts to work fine (those incorrect no-unused-vars are gone) but my app is unresponsive (I click on different buttons and/or links and nothing happen). The only error I see in the console after the update is this one:

Uncaught ReferenceError: process is not defined
    at Object.4043 (<anonymous>:2:13168)
    at r (<anonymous>:2:306599)
    at Object.8048 (<anonymous>:2:9496)
    at r (<anonymous>:2:306599)
    at Object.8641 (<anonymous>:2:1379)

I was searching this error and I found this question. The error is the same maybe not what the developer describes but reading through the answers I see many of them point to react-scripts as the root cause and that maches my scenario.

I tried some of the solutions in that question, in particular method 1 from this answer (I did not try method 2 because I am not sure if adding craco is what I want) and the solution from this other answer too but they do not work.

I also tried updating to react-scripts version 5 but I get A LOT of errors.

Is someone facing this issue or at least has some clue that could help me?

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source