'Getting started with Create React App - "Cannot find module"

I'm using the "Getting Started" guide because I've been experiencing endless errors trying to create a react app so far when following tutorials.

And straight away I'm running into a problem. When I run npx create-react-app my-app I get the following:

Cannot find module 'C:\Users\Aristophanes\node_modules\create-react-app\index.js'

Can anyone advise me what I'm doing wrong? Thanks.



Solution 1:[1]

This must be a problem related with your node installation (maybe you removed manually create-react-app package?). I'd recommend following these steps:

  1. Uninstall node and npm
  2. Delete the npm cache and npm modules in your machine (In Windows machine you can usually find them at C:\Users\ {username} \AppData\Roaming\npm-cache and C:\Users\ {user name} \AppData\Roaming\npm) respectively.
  3. Install node and npm again

If you really don't want to delete node and npm, try step 2 and see if that works. Following these steps did the job for me, hope that helps you.

Solution 2:[2]

I think you might miss installing Node and npm in your machine.

Solution 3:[3]

I had same issue a few times. Every time I was searching thru net for a solution, and for every time i just typed in terminal

npm i node

and its just started working

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Santiago Benitez
Solution 2 Rajesh Bhartia
Solution 3 Fannoth