react ,creating a project issue (npx create-react-app) - node.js

npm version = 6.14.4
node version = v12.16.2
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 '...79WvYfkfE4XCeqsdvhNxl'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\divya\AppData\Roaming\npm-cache_logs\2020-04-26T11_35_57_318Z-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 firstproj/ from C:\Users\divya\React
Done.

So, apparently the issue is from npm and non of us has done anything wrong.
try this : npm install -g --force create-react-app
if did not work,still we can use Yarn to start a new react project while they solve it, follow the steps:
step 1: yarn init -y
step 2: Insert this to package.json
"resolutions": {
"is-promise": "2.1.0",
"run-async/is-promise": "2.1.0"
}
step 3: yarn add --dev create-react-app
step 4: yarn create-react-app ../my-app

I was also facing almost same type of problem. But then tried
yarn create react-app my-app
in power shell with admin privilege which seemed to do the trick.
Also you’ll need to have Node >= 8.10, yarn >= 0.25+ on your machine as the official doc suggests. Hope this helps.

Related

I am getting error while making React app

When I try to make a React app using npx create-react-app amazon
It shows me
Creating a new React app in E:\React\amazon.
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 '...totype.trimstart":"^1'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\SVG\AppData\Roaming\npm-cache\_logs\2020-10-16T06_12_32_500Z-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 amazon/ from E:\React
Done.
Thanks
Ok it got fixed I had to uninstall node.js, delete all folders and re-install node.js and it worked!

problem with install and creat my first react app

here is the img description of the error
first it creates the folder (my-app), but after a few seconds it will be removed automatically. Either I installed the latest version of node.js.
$ npx create-react-app my-app
npx : 98 installé(s) en 23.154s
Creating a new React app in D:\Mon-Travail-Personnel\my-work-with-REACT\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
until know it's good but after :
**
npm ERR! Unexpected end of JSON input while parsing near '...rg\r\n\r\nwsFcBAEBCAA'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\khith\AppData\Roaming\npm-cache_logs\2020-05-29T16_51_36_753Z-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 my-app/ from D:\Mon-Travail-Personnel\my-work-with-REACT
Done.
**
Could you try this,
Clear cache: npm cache clean --force
Install create-react-app globally: npm i create-react-app -g
Create your React project: create-react-app my-app
The problem should mostly be resolved with Step 1.

Why do I keep receiving an error when trying to install my react app

This is my first time trying out React and it's very demoralising to keep seeing the same error over and over again. I tried all three of these codes seperately
npx create-react-app myapp
npm init react-app myapp
npm install -g create-react-app then create-react-app myapp
All which gave me:
npm ERR! Unexpected end of JSON input while parsing near '...:"^5.0.0 || ^6.0.0"},'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\{hiddenForPrivacyReasons}\AppData\Roaming\npm-cache\_logs\2020-04-18T14_12_44_513Z-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 my-app/ from D:\{hiddenForPrivacyReasons}\codes\app
Done.
Help!!!
You don't need react-app and other scripts
Simply:
npx create-react-app my-app
cd my-app
npm start
Refer: document of create-react-app

npm ERR! Unexpected end of JSON input while parsing near '..."jscs":"~3.0.7","moch'

I have a problem with npm. I tried: npx create-react-app my-app but it returned an error.
My command prompt output:
c:\Users\sysli\Desktop\reactprojects>npx create-react-app my-app
npx: installed 91 in 34.825s
Creating a new React app in c:\Users\sysli\Desktop\reactprojects\my-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 '..."jscs":"~3.0.7","moch'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\sysli\AppData\Roaming\npm-cache\_logs\2019-12-26T21_21_02_198Z-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 my-app/ from c:\Users\sysli\Desktop\reactprojects
Done.
Log file:
https://justpaste.it/3s5ym
Update npm on your machine (Prasool advice):
sudo npm i -g npm
If it does not work as expected, please use
npm cache clean --force
as it seems to work for some around here and GitHub. :)
Have a happy coding time!
Can you retry after updating npm?
npm install -g npm
Please note that this command will remove your current version of npm. Make sure to use
sudo npm install -g npm if on a Mac.

Getting error on npm start create-react-app

I am currently learning React. I have done:
npm i -g create-react-app (sucessful)
create-react-app react-app (sucessful)
cd react-app
npm start (error above)
Output:
npm start \Git\cmd was unexpected .at this time.
npm ERR! code ELIFECYCLE
So, what I have tried by searching online:
npm cache clean --force
delete node_modules
delete package-lock.json
npm run clear
npm install
None solved. I have read that I should not installed globally but now that it is already instaled (?) can I rollback? I can't run npm i g create-react-app again.
Thank you
Edit: Added screenshot
https://i.ibb.co/mNKLskX/Capturar.png
with npm try init
npm init react-app my-app
or, try npx:
npx create-react-app my-app
cd my-app
npm start
Have you tried to follow the steps from 'create-react-app'?
`To create a new app, you may choose one of the following methods:
npx
npx create-react-app my-app
(npx comes with npm 5.2+ and higher, see instructions for older npm versions)
npm
npm init react-app my-app
npm init is available in npm 6+
Yarn
yarn create react-app my-app
yarn create is available in Yarn 0.25+`
To have more info: https://github.com/facebook/create-react-app

Resources