create-react-app not working. Getting error "Module not found" - reactjs

This is what I'm getting
I am not able to create a project using create-react-app, I get the error "Module not found".
Node version is 17.0.1 and Npm version is 8.1.1
I have reinstalled nodejs 3 times now and have tried different commands like
npm install create-react-app -g
npm cache clean --force
P.S - I have updated the nodejs to 17.0.1 as the picture version shows 16.13.0

You can try with npx create-react-app my-app.
Visit for more details create-react-app
To create a new app, you may choose one of the following methods:
npx
npx create-react-app my-app
npm
npm init react-app my-app
npm init <initializer> is available in npm 6+
Yarn
yarn create react-app my-app
yarn create is available in Yarn 0.25+

So after almost 3-4 hours of trying different things, it has worked.
I dont know which particular thing would have helped it to work but following are the things I tried -
Delete npm and npm cache folder.
Reinstall the nodejs (LTS version).
Create the app in another folder.
Used power shell instead of CMD.
npm fix
npm fix --force

Related

While creating a react app I'm getting following error or errors

I ran create-react-app and get this error message I did the followings like uninstalling global and so no but getting the same again and again.
You are running `create-react-app` 4.0.0, which is behind the latest release (4.0.1).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/
npm ERR! code 1
npm ERR! path J:\Akhlak_hossain_jim
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ""create-react-app" "ahj-app" "--use-npm""
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Akhlak Hossain Jim\AppData\Local\npm-cache\_logs\2020-11-24T15_16_27_423Z-debug.log
Edit:
I've also tried the following:
Using npx instead. - but that's not working and is showing the above error message.
Uninstalled create-react-app using npm uninstall -g create-react-app before running npx create-react-app ahj-app - however that also doesn't work.
npm install -g create-react-app
Above worked for me.
Do not use npm to install "create-react-app" instead use npx this way:
npx create-react-app my-app
it will always use the lastest version
I solved this using the following command.
npm uninstall -g create-react-app
then again install
npm install -g create-react-app
PS D:\ReactProjects> npx create-react-app sample-app
Creating a new React app in D:\ReactProjects\sample-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npx create-react-app#5.0.0 ahj-app
Specify the latest version explicitly when creating new app

create-react-app is not working since version 4.0.1

I tried installing create-react-app using npm i create-react-app, npx create-react-app new-app and npm init react-app new-app, but I keep getting this error message:
You are running create-react-app 4.0.0, which is behind the latest
release (4.0.1). We no longer support global installation of Create
React App.
How can I fix this?
This worked for me:
npx create-react-app#latest your-project-name --use-npm
According to the create-react-app docs, create-react-app should not be installed globally:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
This is even stated in the error message you recieved:
You are running create-react-app 4.0.0, which is behind the latest release (4.0.1).
We no longer support global installation of Create React App.
You must uninstall create-react-app with npm uninstall -g create-react-app.
Then each time you want to create a new React app with create-react-app, use the command npx create-react-app my-app.
So to fix the error you're getting, uninstall create-react-app globally, update npm, clear the cache, and retry creating the app.
Run this in your terminal:
npm uninstall -g create-react-app && npm i -g npm#latest && npm cache clean -f && npx create-react-app#latest my-app --use-npm
I got
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
so I simply called the package with an explicit version:
npx create-react-app#5.0.0 app-name
I also faced this issue after they released v4.0.2.
They have mentioned this:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
I resolved the issue by following the below steps:
Uninstall create-react-app v4.0.1:
# for npm:
npm uninstall -g create-react-app
# for yarn:
yarn global remove create-react-app
You are not required to install create-react-app in your local directory, so if you do not want to do this then move to step 3. If you want to do this, install v4.0.2 without using the global flag (-g or --global) using the below command:
# for npm:
npm i create-react-app
# for yarn:
yarn add create-react-app
You can now create a new React app using the below command:
# for npx:
npx create-react-app my-app
# for npm:
npm init react-app my-app
# for yarn:
yarn create react-app my-app
I also face the same problem but the problem gets solved when I uninstall the create-react-app globally and then again install it globally.
Uninstalling Command:
npm uninstall -g create-react-app
installing Command:
npx create-react-app my-app
if you have an older npm version (npm version < 5.2) then use this command :
npm install -g create-react-app
it solved my problem I hope it will solve yours
Updating NPX worked for me. Suggestions on this page didn't do the trick but might have contributed.
npm update npx
What worked for me was:
npm uninstall -g create-react-app
And then:
npm i create-react-app # or yarn add create-react-app
I also updated the Node version.
Uninstalling create-react-app globally via npm and reinstalling without the global flag did not work for me.
npm uninstall -g create-react-app
npm install create-react-app
I was on node version 15.2.0. I upgraded to the latest stable node version 15.3.0 via nvm.
nvm install node
Then I installed create-react-app again (no global flag).
npm install create-react-app
I was then able to successfully create a new react app.
npx create-react-app my-app
EDIT: The above will install create-react-app to your current directory. To be clear, after uninstalling create-react-app globally I was no longer able to create an app via npx and received the same original error message. The best solution I've found so far is to run npm install -g npm#latest which downgraded my npm version from 7.0.14 dev build to 6.14.9 LTS build and allowed me to create the react app via npx without issue.
npm uninstall -g create-react-app
Although the uninstall command ran successfully , it was not able to uninstall create-react-app, so i kept running into the same error again and again
This finally worked for me npx create-react-app#latest my-app --template typescript
After create-react-app > 4.0.1 use these commands
npm
npm init react-app my-app
yarn
yarn create react-app my-app
Getting Started | Create React App Docs
I have nvm installed, and while using the command npx create-react-app my-app; I got this error:
You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.2).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
I confirmed that I did not have create-react-app installed globally in my nvm global directory.
I solved issue by specifying the version of the package
npx create-react-app#4.0.2 my-app
For me it was the issue with my npm version. So i did this:
npm install npm#latest -g
Now npx create-react-app app_name works.
I had to downgrade to the latest stable version of node with n in order to make it work.
sudo n stable
Just to make it clear, I never installed it globally, I just had this problem after upgrading node.
There are two different causes of this error:
You have create-react-app installed globally. Use this command to find out if you do: npm list -g --depth 0. If so, follow the instructions in the error message to uninstall it globally.
You are using node v15.0.0+. Use NVM to switch to the LTS nvm use --lts and then run create-react-app. After that you can switch to v15.0.0+ and continue working. (If you do not have NVM installed, here is how you can install it: https://github.com/nvm-sh/nvm)
For me I got the same error even though create-react-app was installed in a parent directory, not globally. So I ran npm uninstall create-react-app without the -g flag and it worked.
Using Git Bash on Windows i run into the same issue today
npx create-react-app appname
even didn't worked after i uninstalled the global installation with
npm uninstall -g create-react-app
What solved the problem for me was to clean the npm cache with the following command
npm cache clean -f
This worked for me.
sudo npm uninstall create-react-app -g
sudo npm install create-react-app#5.0.0 -g
npx create-react-app my-app
I know I'm late to the party, but here are my two cents to help you. This is how I made it worked
Uninstall Global create-react-app installation
npm uninstall -g create-react-app
Now clear the npx cache by
npx clear-npx-cache
Now try to create the application; if you still get the error saying we don't support create-react-app, change the directory to create the application
run
npx create-react-app my-app
This is how I made this worked
i was facing same issues a while ago
npx create-react-app#latest app-name
worked for me
Solution-1: Update your node package manager by using the command below.
npm install -g npm#latest
npx create-react-app my-app
Solution-2: Run your PowerShell as administrator and run the commands. Something this will not work
npm uninstall -g create-react-app
npm install -g create-react-app
//OR
npx create-react-app my-app
Solution-3: The permanent solution is to uninstall node.js and NPM and install them once again.
enjoy
use this :
npm install create-react-app
I ran into this myself today and my root cause is likely very rare but perhaps it will help someone else.
I had an npm registry defined in my .npmrc which my work requires us to use. Turns out my work mirror didn't have 4.0.1 and something in create-react-app must phone home and run a version check.
If you have a registry defined run npm view create-react-app to check the latest version.
After exploring the Github issues a bit I found a solution to this problem that was posted, which doesnt require downgrading node or npm.
I'm using Ubuntu on WSL2 so keep in mind locations might vary. The problem comes from npm having cached a global installation of create-react-app with npx that is v4.0.0 which doesnt show when you use npm view create-react-app.
If you find your npm cache which for me was located in ~/.npm/_npx/ folder, you will find folders with hashed names from all your global installs where you have used npx previously.
If you look through each of them for example with cat [hash]/package.json and note down the hash of any that contains create-react-app. Now go ahead and manually edit the package.json files to bump the version of create-react-app to 4.0.1 - and afterwards remove it from node modules with rm -rf [hash]/node_modules/create-react-app.
After this if you go back out and try to run npx create-react-app my-app it will prompt you to install 'create-react-app' as normal and should work fine, and now npx will have cached the correct version of 'create-react-app' so you wont have the issue again either. And you can use whichever version of node and npm you like.
If you're on Windows or Mac you have to figure out where the cache is located, as I don't know - but the rest of the steps should be the same.
i didn't have any global create-react-app i just did npm uninstall -g create-react-app and then i did npm install create-react-app
I ran into the same problem and the error isn't quite as explanatory as it should be. I fixed it by updating npx itself.
Please type in npm update npxin your terminal to resolve the problem.
After that you can type in npx create-react-app "your preferred project name" to create your react project.
I've uninstalled create-react-app globally also from yarn
npm uninstall create-react-app -g
And the reinstalled create-react-app
npm i create-react-app
or another way is:
npm create-react-app#latest my-app
npm create-react-app#4.0.2 my-app
The other answers didn't work for me. Trying to uninstall globally, for instance, might work to uninstall it but the error persists. It persisted across new installations of Node, and so on.
However, the following seems straightforward and worked for me:
Go into some fresh folder, in which you'll create the app, so that it doesn't already know about create-react-app.
yarn add create-react-app
yarn run create-react-app myapp
SOLUTION:
Step # 1: Remove globally the create-react-app package:
npm uninstall -g create-react-app
Step # 2: Install again globally the create-react-app package:
npm install -g create-react-app
That will install the version 5.0.1 (or higher). To check if it was properly installed, run this on the terminal:
npm list -g
Result:

And then try again to create the react app, using the sentence:
npx create-react-app <project_name>
And then it will work.
This worked for me
npm uninstall -g create-react-app
then
npm install -g create-react-app
I uninstalled node.js and reinstalled it using windows installer. Now npx create-react-app command works like a charm.

npm error when install react project in create-react-app

Hi thanks for reading this topic
I work with react I nowadays trying to learn ReactJS when install react new app show an error for uninstall react new project
what is my problem
in Command Terminal
npm ERR! Unexpected end of JSON input while parsing near
'...9.1","tslint-config
-p'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\john\AppData\Roaming\npm-cache_logs\2019-12-26T01_36_25_1
39Z-debug.log npm install --save #testing-library/react#^9.3.2
#testing-library/jest-dom#^4.2 .4 #testing-library/user-event#^7.1.2
failed
I think it's version problem.
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version
Quick Start
npx create-react-app my-app
cd my-app
npm start
For more clarification check this reactjs
I faced the same problem quite a few times.
Then used following commands, it worked for me
npm init
npm cache clean force
npx create-react-app my-app
cd my-app
npm start

Creating a react App starts aborting installation

While creating a new react app, getting this error.
Aborting installation. yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\.... \my-app has failed.
I know #5328 gave solution by removing . npmrc file here - https://github.com/facebook/create-react-app/issues/5328#issuecomment-429148117
I am new to react .. so can some one please let me know how do I find .npmrc file and how do i remove it? Or how do I create a new react app without having this error?
I know we can create a react app with the following command:
npx create-react-app my-app
or
yarn create react-app my-app
or
npm init react-app my-app
Thanks!
Okay,
I solved this problem by following the below steps:
npm install -g npm#latest
npm install node
npm install -g yarn
yarn cache clean
npx create-react-app my-app
I faced the same issue while creating a new app with CRA.
I tried all the below-mentioned solution:
1) Uninstall Yarn and install again.
2) yarn cache clean
3) npm uninstall -g create-react-app and install again.
Here's main issue:
error #typescript-eslint/eslint-plugin#2.13.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "10.11.0"
error Found incompatible module.
You may have got something similar. Look a couple of lines above "Aborting installation"
In my case, I was using Node version "10.11.0". I install a stable version of Node and it worked absolutely fine.
To double-check I tried to simulate the issue by changing the version with the help of NVM, and got the same issue.
Please refer to the error message and you'll figure out the culprit.
Note: I would still suggest keeping the updated and stable version of Yarn and CRA.

create-react-app throws error: "Missing dependencies in package.json"

So I'm trying to run reactjs official tutorial and with the first line of code:
npx create-react-app react-tutorial
...I get the following error:
npx: installed 91 in 12.692s
Creating a new React app in /home/foo/projects/react-tutorial.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.12.3
[1/4] Resolving packages...
warning react-scripts > fsevents#2.0.6: Please update: there are crash fixes
[2/4] Fetching packages...
[-----] 1/1297Missing dependencies in package.json
I read some where else to clean or force clean npm cache but that didn't work either:
npm cache clean --force
I'm on ubuntu running latest node (10.16.0) I also tried with 8.*
It seems that the error is discussed in this issue:
This seems to be a Yarn issue.
The workaround is to use npm instead of yarn:
create-react-app myproject --use-npm
If installing with npm you experience the following error:
npm ERR! cb() never called!
increase the ulimit in your .bashrc, .bash_profile, and/or .profile by updating (or removing) the below command:
ulimit -n 20000
Looks like you are using yarn instead of npm. Try --use-npm flag like this :
npx create-react-app react-tutorial --use-npm
I fixed this issue by installing yarn and then:
npx create-react-app my-app
cd my-app
npm start
Some people uninstalled yarn and used npm instead, I am not sure why npm did not work for me.
Try to upgrade npm version on your system.
Also upgrade your node.js version to the latest one.
I have solved this issue here all steps are written look into it..
reinstall npm(react) using the following command
npm install -g npm-reinstall
to some users, it may ask to audit fix do it
npm audit fix
npm audit fix --force
after it will take 2-5 min then write our command for creating a new project in react using npm
npx create-react-app amazon --use-npm
After the common step to start the server
cd amazon
npm start

Resources