I am trying to use npx create-react app but i have errors that is shown below:
npm ERR! Unexpected end of Json input while parsing near
'...eact-app/-/create-rea'
npm ERR! A complete log of this run can be found in: npm ERR!
C:UsersdpAppDataRoamingnpm-cache_logs2018-12-06T18-42-56-293Z-debug.log
Install for create-react-app@latest failed with code 1**
and the log file of the error is here…!
How I can get rid of this trouble??
0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli
'C:\Users\dp\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'create-react-app@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli
'C:\Users\dp\AppData\Roaming\npm-cache\_npx\3588',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json' ]
2 info using npm@6.4.1
3 info using node@v10.13.0
4 verbose npm-session 7862701600d4f4ce
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 304
https://registry.npmjs.org/create-react-app 872ms (from cache)
8 silly fetchPackageMetaData error for create-react-app@latest
Unexpected end of JSON input while parsing near
'...eact-app/-/create-rea'
9 timing stage:rollbackFailedOptional Completed in 4ms 10 timing
stage:runTopLevelLifecycles Completed in 1693ms 11 verbose stack
SyntaxError: Unexpected end of JSON input while parsing near
'...eact-app/-/create-rea' 11 verbose stack at JSON.parse
(<anonymous>) 11 verbose stack at parseJson
(C:UsersdpAppDataRoamingnpmnode_modulesnpmnode_modulesjson-parse-better-errorsindex.js:7:17)
11 verbose stack at consumeBody.call.then.buffer
(C:UsersdpAppDataRoamingnpmnode_modulesnpmnode_modulesnode-fetch-npmsrcbody.js:96:50)
11 verbose stack at process._tickCallback
(internal/process/next_tick.js:68:7) 12 verbose cwd C:Usersdp 13
verbose Windows_NT 6.3.9600 14 verbose argv "C:\Program
Files\nodejs\node.exe"
"C:\Users\dp\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js"
"install" "create-react-app@latest" "--global" "--prefix"
"C:\Users\dp\AppData\Roaming\npm-cache\_npx\3588" "--loglevel"
"error" "--json" 15 verbose node v10.13.0 16 verbose npm v6.4.1 17
error Unexpected end of JSON input while parsing near
'...eact-app/-/create-rea' 18 verbose exit [ 1, true ]
Sanjeev
4,2252 gold badges28 silver badges37 bronze badges
asked Dec 6, 2018 at 18:53
4
To fix the issue, run these commands in sequence
npm init
npm install create-react-app
npx create-react-app myapp
Sanjeev
4,2252 gold badges28 silver badges37 bronze badges
answered May 24, 2019 at 18:35
Qalib AbbasQalib Abbas
1,2511 gold badge6 silver badges3 bronze badges
3
Clean npm cache:
npm cache clean --force
then try again
answered Jun 20, 2019 at 17:59
BOOMHUNKBOOMHUNK
3563 silver badges6 bronze badges
0
First, clear cache by typing this in your terminal:
npm cache clean --force
Then upgrade your version of npm by either following these steps or type:
npm install -g npm@next
Now go to «NodeJS» in Programs and Features in your Windows settings and Repair your installation.
Restart terminal and type:
npx create-react-app my-app
This should hopefully fix your issue.
answered Jun 4, 2020 at 17:19
Raisa ARaisa A
4456 silver badges21 bronze badges
I had the same problem in creating react project when I used commands from official source https://reactjs.org/docs/create-a-new-react-app.html#create-react-app
npx create-react-app my-app
cd my-app
npm start
The above commands din’t work on my windows.
I have Node >= 6 and npm >= 5.2 on my machine even then
it is not able to open localhost:3000
then I used this commands
npm install -g create-react-app
create-react-app my-app-name
cd my-app-name
npm start
It worked perfectly fine.
I learned from https://www.youtube.com/watch?v=pCgDRgmfilE
answered May 23, 2019 at 12:42
Raman KumarRaman Kumar
3613 silver badges10 bronze badges
1
This worked for me!!
first you need to create the package.json file by
npm init
then
npx create-react-app myapp
answered Dec 17, 2019 at 8:47
1
npm uninstall -g create-react-app
npx create-react-app my-app
You don’t need to install the create-react-app package globally. ‘npx’ is already installing with the latest version.
Quick start
answered Jul 13, 2020 at 8:29
yunusunveryunusunver
5106 silver badges16 bronze badges
Sometime it happens because of slow internet speed.
Try with this one.
npx create-react-app <app name> -timeout=60000
Default timeout=30000(30sec). increase timeout, if you necessary.
answered Nov 30, 2020 at 18:04
SaimumIslam27SaimumIslam27
9521 gold badge8 silver badges13 bronze badges
The problem arises due to so many reasons.
-
- This happens is if one of the node modules requires to install your react app is missing.
-
- The other reason is if your have and unstable network connection.
-
- Sometimes, but on rare cases, your antivirus may assume the cmd files in your cache to be malware.
if your antivirus is your issue, disable it for the period you run the commands.
Whatever the reason for npx create-react-app is not working on your machine, run the following commands in sequence:
npm cache clean --force
npx create-react-app my-app
let me know if this worked for you
answered Dec 26, 2020 at 6:28
hubnotchhubnotch
311 silver badge6 bronze badges
1
-
In your antivirus whitelist the node software
-
hey guys in my point of view, check your system any antivirus is running and blocking the node.exe more specifically (ByteFence Anti-malware)
-
In my case its blocking the node system call
-
I quit this from hidden icons in the system tray it works fine for me
when you do => npm start
- you may have seen some antivirus asks permission to add it to whitelist or add it to block list that antivirus you should stop or add whitelist to it
answered Jan 1, 2021 at 11:47
1
Same issue, and here is my solution.
npm cache clear —force
answered Jan 21, 2021 at 10:39
there is bug because your user pc name contains space ,
you could resolve this with this code :
> npm config set cache "C:Usersmycomputer~1nameAppDataRoamingnpm-cache" --global
answered Feb 22, 2021 at 6:10
I ran into this kind of problem. It took a lot of googling and experimenting to come up with a standard solution that will require no hassle at all. You don’t need to clear any cache or make any folder changes
I found out that whenever I run
npx create-react-app myapp
I get this error
A template was not provided. This is likely because you're using an outdated version of create-react-app.
To solve this issue and subsequent issue that might arise using npx
, do either of the following:
NB: Install volta before using volta.
Make sure you have node installed..
npm install npx
volta install npx
I highly recommend that you use volta to manage your dependencies as it is faster and its flexible to use. it install the latest of any package you want to install unless you indicate otherwise.
Get volta here.
When you’re done updating npx, your npx error will of the past.
Reach out if you encounter any errors.
answered Jul 2, 2022 at 9:33
hubnotchhubnotch
311 silver badge6 bronze badges
-
In your antivirus whitelist the node software
-
hey guys in my point of view, check your system any antivirus is
running and blocking the node.exe more specifically (ByteFence Anti-malware) -
In my case its blocking the node system call
-
I quit this from hidden icons in the system tray it works fine for me
when you do
npm start
- sometimes you may seen some antivirus asks permission to add it to
whitelist or add it to block list that antivirus you should stop or
add whitelist to it
answered Aug 28, 2020 at 15:56
I tried everything and nothing worked.
I then restarted my laptop, and when I tried npm init
followed with npm install create-react-app
I got an Avast potential harmful file alert, but it was ok and I confirmed it.
That create-react-app
attempt failed, but when I tried it again it worked.
It’s possible that a firewall or such is blocking node from carrying out a function, hence why it’s throwing a callback() never called error.
answered Dec 8, 2020 at 23:29
This worked for me:
because i had network issues
npx create-react-app <app name> -timeout=60000
answered Feb 23, 2021 at 10:20
npm cache clean --force
npx create-react-app project_name --template all
cd project_name
npm start
answered Mar 17, 2021 at 5:47
ChaurasiaChaurasia
4941 gold badge6 silver badges22 bronze badges
This worked for me.
npm cache clean --force
npm init -y
npx create-react-app my-app
answered Jan 30, 2021 at 14:20
If you’re using a VPN it will fail. In my case it said:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for loader-utils@^2.0.4.
npm ERR! notarget In most cases you or one of your dependencies are
requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in: ...
Needless to say I tried everything until I started doubting my life, career and everything in between, and then gave the «it’s a network issue» try with 0 confidence.
And it worked.
answered Feb 10 at 13:47
MarghenMarghen
2352 silver badges6 bronze badges
Here is my solution. Uninstall nodejs and reinstall nodejs again. After that, run these commands:
npm i
npm i -g create-react-app
npm i create-react-app
npm init
npx create-react-app my-app
That worked for me. The main issue was my nodejs was not up-to-date, and I have unstable network connection. That’s why had to reinstall nodejs.
answered Feb 10 at 18:54
Run Windows PowerShell as administrator and type this:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
answered Jan 19, 2020 at 10:47
try this:
npm cache clean --force
npx create-react-app myapp
It worked for me.
answered Apr 30, 2021 at 7:02
1
please run npm cache clean --force
If you are using VS code
, please make sure you restart
the terminal.
It will be okay to start the new project.
answered Jan 23, 2022 at 6:57
JadenJaden
1814 silver badges15 bronze badges
First create a folder with
Mkdir (folder name)
Second Cd into the folder
Cd folder_name
Thirdly run npx create-react-app ./
This will create a new react app for you.
answered Apr 30, 2022 at 14:37
2
First download new version of Node
Which is version 17 now in April 2022,
Secondly make directory
mkdir appName
Thirdly
cd appName
Lastly
npx create-react-app ./
This is how to get Reactjs application in React 18.
answered Apr 30, 2022 at 15:09
1
- sudo chown -R 1000:1000 «/home/aditya/.npm»
- npx crate-react-app
this should fix the issue.
answered Dec 9, 2019 at 16:03
==================================
First Time -> I Found Error (Use Git Bash)
$ npx create-react-app test
Creating a new React app in C:React_TEEtest.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template…
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: type-fest@0.11.0
npm ERR! node_modules/type-fest
npm ERR! type-fest@»^0.11.0″ from ansi-escapes@4.3.1
npm ERR! node_modules/ansi-escapes
npm ERR! ansi-escapes@»^4.3.1″ from jest-watch-typeahead@0.6.1
npm ERR! node_modules/jest-watch-typeahead
npm ERR! jest-watch-typeahead@»0.6.1″ from react-scripts@4.0.1
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@»» from the root project
npm ERR! ansi-escapes@»^4.2.1″ from @jest/core@26.6.3
npm ERR! node_modules/@jest/core
npm ERR! @jest/core@»^26.6.0″ from jest@26.6.0
npm ERR! node_modules/jest
npm ERR! jest@»26.6.0″ from react-scripts@4.0.1
npm ERR! node_modules/react-scripts
npm ERR! 1 more (jest-watch-typeahead)
npm ERR! 1 more (jest-cli)
npm ERR! 2 more (jest-watcher, terminal-link)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional type-fest@»^0.13.1″ from @pmmmwh/react-refresh-webpack-plu
gin@0.4.2
npm ERR! node_modules/@pmmmwh/react-refresh-webpack-plugin
npm ERR! @pmmmwh/react-refresh-webpack-plugin@»0.4.2″ from react-scripts@4.0.1
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@»» from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with —force, or —legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:UsersMikuAppDataLocalnpm-cacheeresolve-report.txt for a ful
l report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersMikuAppDataLocalnpm-cache_logs2021-01-29T19_19_32_095
Z-debug.log
Aborting installation.
npm install —save —save-exact —loglevel error react react-dom react-scripts
cra-template has failed.
Deleting generated file… package.json
Deleting test/ from C:React_TEE
Done.
npm ERR! code 1
npm ERR! path C:React_TEE
npm ERR! command failed
npm ERR! command C:WINDOWSsystem32cmd.exe /d /s /c create-react-app test
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersMikuAppDataLocalnpm-cache_logs2021-01-29T19_19_32_148
Z-debug.log
==================================
I Fix Error (Use Git Bash)
npm uninstall create-react-app
npm uninstall -g create-react-app
npm i -g npm@latest
npm cache clean -f
npx create-react-app my-app
.
.
.
Happy hacking!
Sometimes, Create React App will produce an error when you try to create a new application using npx
or npm init
.
When I try to create a new React application this morning, I got a message saying that I can’t create a new React app as follows:
$ npx create-react-app my-app
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
You are running `create-react-app` 4.0.3, which is
behind the latest release (5.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 /Users/nsebhastian/Desktop/DEV
npm ERR! command failed
npm ERR! command sh -c create-react-app "my-app"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nsebhastian/.npm/_logs/2022-05-09T02_20_51_340Z-debug.log
The error above happens because Create React App thinks I have an older version of CRA installed on my computer.
But when I run the two uninstall commands above, I don’t see any package being removed from my npm modules:
$ npm uninstall -g create-react-app
up to date, audited 1 package in 97ms
found 0 vulnerabilities
$ yarn global remove create-react-app
yarn global v1.22.17
[1/2] 🗑 Removing module create-react-app...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/global
for documentation about this command.
I didn’t find create-react-app
package either when I ran npm list
command:
If you receive the same error, then the problem happens because npm keeps a cache of the Create React App that you’ve installed previously.
When you try to install CRA from npx
as shown below:
$ npx create-react-app my-app
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
Then npm will try to install the package using the cache stored from your previous install.
To resolve this error, you need to clear the cache of npx
with the following command:
If you’re using npm init
, then try to clear the npm cache with the following command:
Once you clear the npx
or npm
cache, you should be able to use create-react-app
to create new applications again.
And that’s how you fix the We no longer support global installation of Create React App
error.
I hope this tutorial has been helpful for you 👍
If you’ve ever used create-react-app as a global installation or through npx, but was previously on version 4.x.x of create-react-app/react-scripts, then you may notice an error when you run the command below, as it tries to use the latest version (5.x.x as of this writing).
npx create-react-app myapp
You are running create-react-app 4.x.x, which is behind the latest release (5.0.1).
We no longer support global installation of Create React App.
The current solution is simple — run create-react-app and target the latest version.
npx create-react-app@latest myapp
Different versions of npm may help as well, and you can upgrade using the following command. Please note that this may affect other projects on your system.
npm install -g npm@latest
Создаю приложение командой npx create-react-app my-app
но выдает ошибку:
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
Но я его никогда не устанавливал глобально. Даже после выполнения этих команд, всё та же ошибка.