Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create-react app #8338

Closed
Austinmac56 opened this issue Jan 18, 2020 · 9 comments
Closed

Create-react app #8338

Austinmac56 opened this issue Jan 18, 2020 · 9 comments

Comments

@Austinmac56
Copy link

My laptop can't create a react app after following the processes

@rohit-ambre
Copy link

can you please explain what exactly is not working in your case??

Even I was facing this issue where only package.json and node_modules was getting created but not the CRA template and that is why I came here to check if anyone else is facing the same.
I tried in windows, ubuntu and WSL ubuntu 18.04 but it was not working anywhere then, I checked my create-react-version by create-react-app --version it was 3.1.0.

then I read this message

A template was not provided. This is likely because you're using an outdated version of create-react-app.

so I upgraded the create-react-app version to 3.3.0 and tried to create the new app and it worked 😃

Try upgrading the package and it might work.

@Austinmac56
Copy link
Author

How do I check the version and update it on my phpstorm to work fine.

@Austinmac56
Copy link
Author

"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npx-cli.js" create-react-app .
npx: installed 91 in 66.423s

Creating a new React app in C:\Users\Gustine\PhpstormProjects\untitled1.

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 '..."unpackedSize":17505,'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Gustine\AppData\Roaming\npm-cache_logs\2020-01-20T10_54_52_673Z-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
Done.
Done

it can't create package.json file
help me fixit

@rohit-ambre
Copy link

Hi @Austinmac56

I think you have not added node's bin path in Environment variable that is why you have to give the whole path to run npm commands, follow this stackoverflow answer to set it.


To answer your actual questions
hit create-react-app --version

to check the version
if it is lower than 3.3.0 then I'll suggest you upgrade create-react-app version by typing following command
npm install -g create-react-app it will install the latest version or update the existing to the latest version.

Now to create your react app just type npx create-react-app <name_of_project>
It should spin up a react project template for you

@itsweliton
Copy link

itsweliton commented Jan 22, 2020

I'm facing the same issue with both ways, npx or create-react-app, it simply does not create the src/ folder, only node_modules/ and package.json

Current node version: v11.15.0 - v10.13.4 also didn't work

image

@cgibsonmm
Copy link

looks like there may be a problem i just ran npx create-react-app and the same as above my package.json ends up looking like

 "name": "client",
 "version": "0.1.0",
 "private": true,
 "dependencies": {
   "react": "^16.12.0",
   "react-dom": "^16.12.0",
   "react-scripts": "3.3.0"
 }
}

and I get nothing else

@rohit-ambre
Copy link

hi @cgibsonmm and @welitonderesende ,
can you post the version of create-react-app package
You can get the version by typing create-react-version --version

You can refer to the previous comment here to update the package if it's already not the latest one. It might just fix your error here as I had the same issue.

@Austinmac56
Copy link
Author

I solved my problem already.
I uninstalled node.js then deleted npm and npm cache.
I also went to user/Gustine/appdata and deleted Nodejs and npm modules.
Reinstall Nodejs and initiate react app creation in your editor terminal.
Hope it works for you

@cgibsonmm
Copy link

cgibsonmm commented Jan 22, 2020 via email

@lock lock bot locked and limited conversation to collaborators Jan 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants