Aristophanes
Aristophanes

Reputation: 485

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.

Upvotes: 2

Views: 4000

Answers (5)

Wilson L. Oliveira
Wilson L. Oliveira

Reputation: 11

Thanks for solutions!

The great solution:

npm install --save react-clear-cache

npm uninstall -g create-react-app

npm install -g --force create-react-app

Upvotes: 1

ITselect
ITselect

Reputation: 153

You'll have to install the library to clean the browser cache after React app updates by running:

npm install --save react-clear-cache

Then uninstall React globally, using

npm uninstall -g create-react-app

then reinstall React globally again:

$ npm install -g create-react-app

Upvotes: 0

Fannoth
Fannoth

Reputation: 11

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

Upvotes: 1

Santiago Benitez
Santiago Benitez

Reputation: 362

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.

Upvotes: 1

Rajesh Bhartia
Rajesh Bhartia

Reputation: 758

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

Upvotes: 0

Related Questions