2

I have been facing a weird situations while creating a react app via command line on windows 10. I get the following error when I run create-react-app command. I am using node v8.9.4 and npm v6.4.0.

Creating a new React app in D:\react\myreactapp. 

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 '...^1.0.1","line-numbers' 

npm ERR! A complete log of this run can be found in: 
npm ERR! C:\Users\USER\AppData\Roaming\npm-cache\_logs\2018-08-26T11_04_03_908Z-debug.log 

Aborting installation. 
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. 

Deleting generated file... package.json 
Deleting myreactapp / from D:\react 
Done.
1
  • run react-native info and edit the question with the result. Commented Sep 13, 2018 at 5:42

1 Answer 1

1

It may have to do with the project name you gave it. Try using dragon-case, i.e. only lower case and hyphens. So instead of

$ create-react-native-app myApp 

use

$ create-react-native-app my-app

or from the error message, could it be that after the app name (myreactapp) you added a space and then pressed the back-slash instead of Enter, before pressing Enter again?

Also, try: npm cache clean --force

and if that doesn't do the trick: yarn cache clean

It may have been caused by a missing linebreak in the React-Native installation instructions in the Readme (that has been fixed since), between npm install and npm start causing users to do npm install npm start - which was installing npm itself with all its tests. See issue: https://github.com/facebook/react-native/issues/20015.

In any case it would be good if you ran react-native info and told us the result.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.