problem with install and creat my first react app - node.js

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.

Related

I am having trouble with creating react app

i was trying to create a new react project but i faced errors i never seen before i tried npm cache clean --force it said npm WARN using --force Recommended protections disabled. so i tried this
npm cache verify
it responded with
it Cache verified and compressed (~\AppData\Local\npm-cache\_cacache)
Content verified: 0 (0 bytes)
Index entries: 0
Finished in 0.013s
but i still cant create react app using the command npx create-react-app projectName
it just responds with
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/html-entities reason: Invalid response body while trying to fetch https://registry.npmjs.org/html-entities: Socket timeout
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\u4\AppData\Local\npm-cache\_logs\2023-01-04T11_43_21_180Z-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 travel/ from C:\Users\u4\Desktop\code
Done.
i updated my node thinking that may be the problem but still no change HELP!!
so i found the source to my problem. first i runed npm -g list and it only had npm no create-react-app so you need to install it using npm install -g create-react-app. check it by running npm -g list if successfully installed create-react-app will be their. now you can run npx create-react-app projctname with out a problem.

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!

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

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.

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.

Resources