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.
Try to clear the npm cache,
execute this command:
npm cache clean --force
If this doesn't work, delete the complete npm cache and npm files from the app data folder and re-install it completely.
from the following path, you can find AppData folder
C:\Users\divya\AppData\Roaming
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.