I am having an error while installing Create-react-app - reactjs

I want to get started with React.js and I am following their official documentation that states to use - npx create-react-app my-app to install the app, but I am getting the error below every time. Please help

You can try the following ways to resolve the error -
Delete everything from C:\Users\your_pc_name\AppData\Roaming\npm-cache
This could be a local caching issue. Try the command npm cache clean --force using administrator mode in your terminal and then try again with the same command - npx create-react-app my-app.
If the above command doesn't work, try the same command or another similiar command - npm cache clear --force and then npm install after that. After this, you can run the commands to setup your react project and see if it works.
These were the point I have referred online from people who faced a similar issue. Try to see if any of the above steps resolve your issue.
I have aggregated the working solutions but if this still doesn't solve your problem, you could refer the links mentioning a similar problem -
https://github.com/facebook/create-react-app/issues/7261
Installing create-react-app gives npm ERR! shasum check failed and npm ERR! Unexpected end of JSON input while parsing near '...mojOzGIEI2rg0m24Yb5Oq'
NPM Install Error:Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'
Error installing reactjs: Error unexpected end of JSON input while parsing near

Related

While run the React application getting error

You need to install 'webpack-dev-server' for running 'webpack serve'.
Error: Cannot find module 'ajv/dist/compile/codegen'
I getting error like this when give npm install to run React application. Please give solution to solve this issue.
I had the same issue when I used JHipster, which I solved by running this command
npm install --save-dev ajv#^7
Thanks to this answer

(error) AWS as backend installing amplify libraries

I am new to backend. Just starting to make a To-Do app in react and was just setting up amazon aws for backend. Using this site for reference ( https://docs.amplify.aws/start/getting-started/setup/q/integration/react#initialize-a-new-backend ).
And at the point Install Amplify libraries I got stuck while i type npm install aws-amplify #aws-amplify/ui-react in root directory it shows me error everytime.[error pic][1] I am trying for a long but did not find any solution. Pls help me in this issue !!
[1]: https://i.stack.imgur.com/hrSeJ.png Here is the error i'm getting in command prompt👇
npm ERR! Unexpected end of JSON input while parsing near '...:"^1.0.0-beta.2","#aw'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Aakash~1Bansal\AppData\Roaming\npm-cache\_logs\2021-04-09T11_41_43_000Z-debug.log
F:\Learning- tanay pratap\AWS\react-amplified>npm install aws-amplify #aws-amplify/ui-react
npm ERR! Unexpected end of JSON input while parsing near '...:"^1.0.0-beta.2","#aw'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Aakash~1Bansal\AppData\Roaming\npm-cache\_logs\2021-04-09T11_45_14_875Z-debug.log
F:\Learning- tanay pratap\AWS\react-amplified>
I was having the same issue. 1st make sure your PC is connected to internet connection. Run:
npm uninstall -g #aws-amplify/cli
npm install -g #aws-amplify/cli
If possible don't minimize the window wait till everything is properly install.
This worked for me.
Still you are facing problems then reinstall node.js and then do this.
Thank you!

npm ERR! Unexpected end of JSON input while parsing near '...grity":"sha512-kyAaTj'

While I was trying to install dependencies related to firebase in my react app, I ran npm install --save firebase but it resulted in an error. All other packages required for my app is installed properly except this. What could be the problem with this particular package?
I have attached the snippet of the error below

This is probably not a problem with npm. There is likely additional logging output above

My MacBook Pro version : macOS MOJAVE version 10.14.5
My node version : v10.16.0
My npm version : 6.9.0
Problem is whenever I install or create npm app via terminal it always occurs an error like : This is probably not a problem with npm. There is likely additional logging output above. I didn't get any perfect answer yet please help me with this.
I will tell you about my command like
npx create-react-app my-app
cd my-app
npm start
but I always get an error when I type npm start.
Please help me with this.
This problem arises from the npm package which is incompatible with the react package you have.
Try Updating both package or uninstall the package which is causing this problem.

How can i correct the error i keep getting in creating a react app

Each time i tried creating a react app using create-react-app <...name> i keep getting this error "
Creating a new React app in C:\windows\system32\brian-todos.
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 '...tXcMskoaoOolrubJ3NQGh'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BrianMartinez\AppData\Roaming\npm-cache_logs\2019-01-12T13_11_25_580Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting brian-todos / from C:\windows\system32
Done."
I even tried npm clear cache it still didn't not work.What do i do about this challenge
It seems you opened your windows console or powershell as an administrator, and you landed in system32 folder. Don't create your project there, that is a reserved folder for system executables. Do something like cd C:\Users\yourusername\Documents and try there.
This is the answer to the challenge i had before now. follow these steps
npm install -g yarn
yarn global add create-react-app
create-react-app

Resources