Install for [ 'create-react-app#latest' ] failed with code 1 - node.js

I have installed node version 12.6.1 on the windows machine.
I have been trying to create react app on my machine using the following command:-
npx create-eact-app my-app
the error:-
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Ahmad\AppData\Roaming\npm-cache\_npx\2904" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Saood Ahmad\AppData\Roaming\npm-cache\_logs\2020-03-01T06_56_47_636Z-debug.log
Install for [ 'create-react-app#latest' ] failed with code 1
screenshot error screen shot
please guide me through
Thanks

this error occurred because you have a space in your username.
you can solve this problem by installing create-react-app globally:
npm install -g create-react-app
then simply run:
create-react-app my-app
(be carefull you have a typo in your explanation:
npx create-eact-app my-app => npx create-react-app my-app

This can be solved by making sure you install create-react-app in your machine.
Run the following commands, either you install create-react-app globally or not
npm install create-react-app
or
npm install -g create-react-app

Related

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.

using npx create-react-app my-app come up with an error

using npx create-react-app my-app but come up with an error.
npm : 6.4.1
node : 11.3.0
how to fix this?
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\nodejs\node_cache\_npx\6612" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Program Files\nodejs\node_cache\_logs\2019-07-13T04_25_44_642Z-d
ebug.log
Install for create-react-app#latest failed with code 1
I found the reason, Running npx globally does not work on windows when the user folder patch contains a space.see this link

npm ERR! Unexpected end of JSON input while parsing near '.../openpgpjs.org\r\n\r\'

I am a newbie to React and trying to start a project
npm version: 6.4.1
create-react-app version: 2.1.8
node version: 10.15.0
I run create-react-app newApp , And got error:
npm ERR! Unexpected end of JSON input while parsing near '.../openpgpjs.org\r\n\r\'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ThunderF\AppData\Roaming\npm-cache_logs\2019-04-> 06T18_16_37_841Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
I faced the same issue but I wrote the following line and it worked.
npm cache clean --force
I got the same problem and I ran these commands
1) npm cache clean --force
2) restart your machine
3) npx create-react-app my-app
(or)
npm install create-react-app enter and then npm init react-app my-app
cd my-app
npm start

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