Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create-react-app error - Cannot find module 'fs-extra'

When I run create-react-app in the CLI I get the following error message back:

    $ create-react-app udacity-goals-todo
internal/modules/cjs/loader.js:573
    throw err;
    ^

Error: Cannot find module 'fs-extra'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
    at Function.Module._load (internal/modules/cjs/loader.js:497:25)
    at Module.require (internal/modules/cjs/loader.js:626:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/create-react-app/createReactApp.js:40:12)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)

I have tried uninstalling and reinstalling create-react-app as well as reinstalling fs-extra.

Any ideas on how to get this up and running again?

like image 606
Mike Bauer Avatar asked Jun 06 '18 15:06

Mike Bauer


4 Answers

you can fix this by uninstalling create-react-app and re-installing it

  • For mac users

1) right-click finder desktop widget

2) click "go to folder"

3) type " /usr/local/lib/node_modules " then enter

4) delete create-react-app folder

5) in terminal type in " npm i -g create-react-app "

  • for window users, i dont know where the globals folder is sorry. i will update this when i find it
like image 52
mayo19 Avatar answered Oct 18 '22 04:10

mayo19


I have had a similar issue earlier with the create-react-app and 'tar' module. I did the following steps to fix it:

npm cache clear --force

npm i
npm i -g create-react-app
like image 42
Parthipan Natkunam Avatar answered Oct 18 '22 04:10

Parthipan Natkunam


I just had the same issue. Although I've always run create-react-app using npx.

The issue was solved by cleaning the yarn cache, yarn cache clean

like image 1
Gustav Avatar answered Oct 18 '22 02:10

Gustav


Facing same or similar issue when running the following:

npx create-react-app .

The following error was thrown:

internal/modules/cjs/loader.js:582

throw err; ^

Error: Cannot find module 'C:\Users\user-name\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.Module._load (internal/modules/cjs/loader.js:506:25) at Function.Module.runMain (internal/modules/cjs/loader.js:741:12) at startup (internal/bootstrap/node.js:285:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

Solution:

Installing or updating npx with the following command:

npm i -g npx

Then running again the original command for project creation in the project's folder:

npx create-react-app .

Then it starts creating your project as expected:

Creating a new React app in <app-folder-path>.

Installing packages. This might take a couple of minutes.

Installing react, react-dom, and react-scripts...

Hope that helps for future searchers!

like image 1
norbitrial Avatar answered Oct 18 '22 04:10

norbitrial