Cannot Create React App Using create-react-app - javascript

I am trying to create a react app with
create-react-app
but it get the following error
Creating a new React app in /home/freduah/react-jumia-clone/react-jumia-clone.
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 '...ct-assign":"^2.0.0","'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/freduah/.npm/_logs/2020-10-26T11_32_34_616Z-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 react-jumia-clone/ from /home/freduah/react-jumia-clone
Done.

Have you tried clearing your cache using npm cache clean --force?

Check your version of npm and other
or,
Try deleting cache in the terminal as :
npm cache clean --force

Related

Why does my terminal keep Flagging error while creating my React App

I have been trying to create my first React App for a while now and it has been flagging me different errors.
This is the code I typed in my Hyper terminal: "npx create-react-app app".
After trying to download for some minutes it would then flag the error below:
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Edmund Obinna\AppData\Local\npm-cache_logs\2022-02-22T11_18_49_833Z-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 app/ from C:\Users\Edmund Obinna
Done.

I've been trying to create a react app but I keep getting this error: "npm ERR! cb() never called!"

this is the problem
HP#DESKTOP-1HP83V8 MINGW64 ~/Desktop/Web-Development (master)
$ npx create-react-app my-app
Creating a new React app in C:\Users\HP\Desktop\Web-Development\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache_logs\2020-11-20T11_50_51_060Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts >cra-template has failed.
I've encountered this multiple times.
First I would suggest that you run npm uninstall -g create-react-app since the global version isn't supported anymore.
Then try npx create-react-app my-app again.
If that does not work, try to run:
npm init
npm install create-react-app
npx create-react-app my-app
The steps above have solved the issue for me a couple of times
Disconnect and reconnect to your source of internet (WIFI).
After that, run npm cache verify
Next you will want to run: rerun npx create
Working Solution: thanks to idkwhatsgoingon's answer.
create-react-app does not work globally
npm uninstall -g create-react-app
npm install create-react-app
create-react-app app01
try this command first:
npm cache clean --force
and create your react app again.
I got the same error .Here these things i did to solve it
I ran npm cache clean --force
after again npx create-react-app project name
I tried all of these, it did not work. But I restarted the computer and it started working ! So after clearing the cache etc, might be be worth restarting the machine ( Windows 10 )
I got the same error when trying to install netlify-cli.
Here are two things I did to solve it:
I deleted some files to clear up disk space
Since my npm version is 6.0+, I ran "sudo npm cache verify"
Add the line
timeout=60000
to your .npmrc config file (create it at ~/.npmrc if it doesn't exist)
then run npx create-react-app project-name should be successful. At least it was in my case. (I had code ERR_SOCKET_TIMEOUT before)
Try installing yarn. I did this and immediately fixed my issues.
npm install --global yarn
first and foremost uninstall create-react-app by
npm uninstall -g create-react-app
then
npm cache clean -f
then
npx create-react-app app-name
this worked for me
I run npm cache verify
After this command, I run sudo apt install rerun
Then I run the command rerun npx create-react-app <app-name>
It worked like magic

react, creating a project issues

i am creating react app like following but i found an error.please guide me what is the error.
E:\React>create-react-app template-app
Creating a new React app in E:\React\template-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 '...pha.24","dependencies'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Muaaz\AppData\Roaming\npm-cache\_logs\2020-08-24T11_52_18_657Z-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 template-app/ from E:\React
Done.
With this sort of thing, it's worth checking the issues on the relevant GitHub repo. From issue #7261, it seems other people have run into this from time to time and running this fixes it for them:
npm cache clean --force

npm related tasks are throwing errors during installations

I've been having this problem recently that nothing related to npm is working for me except npm start.
npm install is giving this error:
$ npm install #material-ui/core
npm ERR! Object for dependency "#babel/generator" is empty.
npm ERR! Something went wrong. Regenerate the package-lock.json with "npm install".
npm ERR! If using a shrinkwrap, regenerate with "npm shrinkwrap".
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Parth\AppData\Roaming\npm-cache\_logs\2020-08-20T13_52_13_701Z-debug.log
npx create-react-app ./ is giving this error:
npx create-react-app ./
npx: installed 98 in 10.023s
Creating a new React app in G:\hel.
Installing packages. This might take a couple of minutes. Installing
react, react-dom, and react-scripts with cra-template...
yarn add v1.22.4 [1/4] Resolving packages... [2/4] Fetching
packages... error An unexpected error occurred: "UNKNOWN: unknown
error, unlink
'C:\\Users\\Parth\\AppData\\Local\\Yarn\\Cache\\v6\\npm-core-js-pure-3.6.4-4bf1ba866e25814f149d4e9aaa08c36173506e3a-integrity\\node_modules\\core-js-pure\\features\\object\\is-frozen.js'".
info If you think this is a bug, please open a bug report with the
information provided in "G:\\hel\\yarn-error.log". info Visit
https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation. yarnpkg add --exact react react-dom
react-scripts cra-template --cwd G:\hel has failed.
Deleting generated file... package.json Deleting generated file...
yarn.lock Done.
EDIT: So I tried using Yarn for my installs but got this error:
$ yarn add #material-ui/core
yarn add v1.22.4
warning package-lock.json found. Your project contains lock files generated by
tools other than Yarn. It is advised not to mix package managers in order to
avoid resolution inconsistencies caused by unsynchronized lock files. To clear
this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "UNKNOWN: unknown error, unlink
'C:\\Users\\Parth\\AppData\\Local\\Yarn\\Cache\\v6\\npm-core-js-pure-3.6.4-4bf1ba866e25814f149d4e9aaa08c36173506e3a-integrity\\node_modules\\core-js-pure\\features\\object\\is-frozen.js'".
info If you think this is a bug, please open a bug report with the information
provided in "F:\\Parth\\covid-19-tracker\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
How do I fix this?
Edit: My version of npm is 6.14.8
First of all you need to make sure that your node and npm versions are up to date. if not please upgrade your node and npm packages to latest versions.
nvm install 12.18.3 // update node version through node version manager
npm install npm // update your npm version to latest
Delete your node_modules folder, package-lock.json and yarn file (if you have).
Force clean the entire NPM cache by using following comand.
npm cache clean --force
Re-Install all the dependencies.
npm install
If above step didn't resolve your problem, try to uninstall yarn globally by delete the Yarn folder from global folder and then run.
npm uninstall -g yarn

getting error while creating a react app using create-react-app

I am trying to create a react app using these two commands .Here are the two commands.
npm install -g create-react-app
create-react-app my-app
I am getting this error on my terminal .
npm ERR! Unexpected end of JSON input while parsing near '...org/jest/-/jest-20.
0.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\satyajeet\AppData\Roaming\npm-cache\_logs\2018-04-01T16_28
_34_038Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts
has failed.
Deleting generated file... package.json

Categories

Resources