react, creating a project issues - javascript

i am creating react app like following but i found an error.please guide me what is the error.
E:\React>create-react-app template-app
Creating a new React app in E:\React\template-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Unexpected end of JSON input while parsing near '...pha.24","dependencies'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Muaaz\AppData\Roaming\npm-cache\_logs\2020-08-24T11_52_18_657Z-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 template-app/ from E:\React
Done.

With this sort of thing, it's worth checking the issues on the relevant GitHub repo. From issue #7261, it seems other people have run into this from time to time and running this fixes it for them:
npm cache clean --force

Related

Why does my terminal keep Flagging error while creating my React App

I have been trying to create my first React App for a while now and it has been flagging me different errors.
This is the code I typed in my Hyper terminal: "npx create-react-app app".
After trying to download for some minutes it would then flag the error below:
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Edmund Obinna\AppData\Local\npm-cache_logs\2022-02-22T11_18_49_833Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting app/ from C:\Users\Edmund Obinna
Done.

create-react-app command failing at the very end, with errno -4058

I've been following a video course for full stack web development, and have gotten to the react part. The video course says that the create-react-app npm package can be used to readily and easily do an initial setup of a react app file hierarchy with all dependencies.
The method discussed in the course is to install the craete-react-app package globally using npm install -g create-react app, which I did. Then I should be creating the react app by using create-react-app my-project-name. When I launch this command, i get an output like this: Screenshot of error. In text:
Creating a new React app in E:\University\Learning material\Web
Development\Udemy - The Complete Web Developer in 2021 Zero to Mastery
2021-4\19. React.js, React Hooks, Redux (Hooks and Redux videos moved
to end of course!)\exercise 1\robofriends.
Installing packages. This might take a couple of minutes. Installing
react, react-dom, and react-scripts with cra-template...
npm ERR! code ENOENT npm ERR! syscall spawn
C:\WINDOWS\system32\cmd.exe npm ERR! path E:\University\Learning
material\Web Development\Udemy - The Complete Web Developer in 2021
Zero to Mastery 2021-4\19. React.js, React Hooks, Redux (Hooks and
Redux videos moved to end of course!)\exercise
1\robofriends\node_modules\babel-runtime\node_modules\core-js npm ERR!
errno -4058 npm ERR! enoent spawn C:\WINDOWS\system32\cmd.exe ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Amin\AppData\Local\npm-cache_logs\2021-05-02T16_25_06_903Z-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 robofriends/ from
E:\University\Learning material\Web Development\Udemy - The Complete
Web Developer in 2021 Zero to Mastery 2021-4\19. React.js, React
Hooks, Redux (Hooks and Redux videos moved to end of course!)\exercise
1 Done.
The log file mentioned in the error has no extra information as far as I can see, only the same error message exactly replicated in a log file along with the preceding installation steps. Just to be sure, I've made 3 pastebins to contain the gigantic log file here: Part 1 Part 2 Part 3
Methods I've tried to resolve the issue (And a combination of some) :
The good old restart your computer!
Clearing the npm cache by usingnpm cache clear -f
Uninstalling create-react app, and reinstalling
Uninstalling create-react-app and using npx create-react-app robofriends to first install the package and then create the app folder right after
Opening my command line in administrator mode
Any help or guidance on the issue will be greatly appreciated. Thank you.
Also, it might help to mention that I am using Windows 10 64bit.
It looks like there is a problem with your path (special characters etc.). If I recreate your exact path on my drive, I fail to create a react-app as well. However, if you change your directory to another one and try again it should work!

Cannot Create React App Using create-react-app

I am trying to create a react app with
create-react-app
but it get the following error
Creating a new React app in /home/freduah/react-jumia-clone/react-jumia-clone.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Unexpected end of JSON input while parsing near '...ct-assign":"^2.0.0","'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/freduah/.npm/_logs/2020-10-26T11_32_34_616Z-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 react-jumia-clone/ from /home/freduah/react-jumia-clone
Done.
Have you tried clearing your cache using npm cache clean --force?
Check your version of npm and other
or,
Try deleting cache in the terminal as :
npm cache clean --force

"npm ERR! unexpected end of JSON input near" while creating a new react app

[enter image description here][1]npm
I am trying for so many times to create a app in react but every time the CMD showing an ERR!
here is code :
Microsoft Windows [Version 10.0.18363.476]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\Sumit>E:
The system cannot find the drive specified.
C:\Users\Sumit>D:
D:>React js
'React' is not recognized as an internal or external command,
operable program or batch file.
D:>react js
'react' is not recognized as an internal or external command,
operable program or batch file.
D:>React js
'React' is not recognized as an internal or external command,
operable program or batch file.
D:>create-react-app my_react
Creating a new React app in D:\my_react.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react (over 30000ms)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_33_43_496Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting my_react / from D:\
Done.
D:>create-react-app my-react-app
Creating a new React app in D:\my-react-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '...Y3hEcJW8se9P4K6+GYGu9'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_34_57_334Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting my-react-app / from D:\
Done.
D:>create-react-app new-react
Creating a new React app in D:\new-react.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '...gAAwSQP/RpJCkm/rgw8jt'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_38_28_735Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting new-react / from D:\
Done.
D:>npm create-react-app my-react-aplication
Usage: npm
where is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
clean-install, clean-install-test, completion, config,
create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, fund, get, help, help-search, hook, i, init,
install, install-ci-test, install-test, it, link, list, ln,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm -h quick help on
npm -l display full usage info
npm help search for help on
npm help npm involved overview
Specify configs in the ini-formatted file:
C:\Users\Sumit.npmrc
or on the command line via: npm --key value
Config info can be viewed via: npm help config
npm#6.14.4 C:\Program Files\nodejs\node_modules\npm
D:>npx create-react-app my-react
Creating a new React app in D:\my-react.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '...gAAwSQP/RpJCkm/rgw8jt'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sumit\AppData\Roaming\npm-cache_logs\2020-06-01T14_54_02_126Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting my-react / from D:\
Done.
D:>
if you didn't install npm in general mode, it should better you do it with this comment in the root with the command
npm install -g
, or if you did it before you need to update it with the command
npm update [-g]
There are two things that you can do that might possibily help you resolve the issue you are facing.
1.If you are on a slow internet connection you might have to increase the timeout from 30s to 60s by adding this to your .npmrc file:
timeout=6000
You can find the .npmrc file at the path:
C:\Program Files\nodejs\node_modules\npm
2. This issue might be due to npm version mismatch, you can try to install the latest npm version by typing the following command in cmd:
npm install -g npm
Hope this helps!!

How to install react app without an error

Hello guys i am trying to install react into my system but from 2 days i am facing the error for several times now. At first, i have used these commands to install react app and it was working fine for me
1. npm install -g creat-react-app
2. create-react-app reactapp
but form 2 days i was facing error while choosing these options to install, therefore I visited https://create-react-app.dev/docs/getting-started/ where it was clearly stated- 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. Then i used the command npx create-react-app reactapp but i am facing this error. I have multiple time uninstalled nodejs and installed, also have used the command npm cache clean --forcetoo. But not working!!!!
e:\react-learn>npm uninstall -g create-react-app
removed 98 packages in 5.031s
e:\react-learn>npx create-react-app reactapp
npx: installed 98 in 39.888s
Creating a new React app in e:\react-learn\reactapp.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Unexpected end of JSON input while parsing near '...wRDiDz3X/FqXhQ==","
sh'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dell\AppData\Roaming\npm-cache\_logs\2020-05-23T12_48_46_9
79Z-debug.log
How to resolve this error???And one interesting thing you know when i copied my previous project and run npm start it is working fine. What is the issue reactapp is justing eating my nerves...
Try clearing your cache and try again.
You can run
npm cache clean --force
or
npm cache clear --force
Try using npx create-react-app client --use-npm. Sometimes some issues arise due to package managers .

Categories

Resources