NPM got stuck in terminal while creating react app? - node.js

I was creating my first react app and I did everything as guided by react Getting Started page.
When I run npx create-react-app first-app or npm init react-app first-app the installing stuff started which took a couple of minutes.Two bars of loading got finished and then the terminal got stuck with a blinking cursor at this point as shown in the image down below.Image here
I waited for around 1 hr before aborting the process.Also when i took a look at the exam-portal folder there was only node_modules,pakage.json and pakage-lock.json files.No src or public folder.
~Any help will be appreciated~
'Thanks in advance'

Follow below steps
update node (and npm) to latest version, if not latest
npm cache clean --force
npx create-react-app first-app

Related

Create React App Stuck after a point "added 1416 packages in 2m"

My terminal window
Help! I've been trying to create a react app on my machine. With the npx create-react-app my-app not working I have tried several commands, finally this command npx create-react-app#latest-version my-app is starting the installation but never goes further this point. Commands like npm start aren't working.
How do i solve this?
I've tried the command npx create-react-app#5.0.1 my-app
I expected react app to be created and it being able to run commands like npm start
i had the same problem and i did 2 things:
used npm i react#latest then npx create-react-app app-name.
changed internet service provider.
if that doesn't work, i suggest using a different pc/laptop and test it again.

why i am not able to install all the dependencies in react?

enter image description hereI tried running all the commands including npx create-react-app npm create-react-app npm install npm clear cache --f everything.
still i am not able to install all the dependencies in my package json
The fact that a package is asking for funding should not affect your installation. It simply means that the author(s) is/are looking for financial support to continue their work.
To create a new installation and avoid possible issues - go to a new directory and type the following on your command prompt:-
npx create-react-app todo1
Then, you need to navigate to the folder of your newly created app, "todo1" by running the following:
cd todo1
Finally to run the app, type the following:
npm start
First I want to say your commands are not clear and those are not separated. I assume you need to create react app with npm package manager.
If you run npx create-react-app todo1 you will create a react app with yarn dependency manager.
If you need to use npm dependency manager use the following command
npx create-react-app todo1 --use-npm
Then check the root directory. it should have the package.json file with necessary initial dependencies.

How to use Create react app to install React

Hi I'm really new to react and I can't figure out how to actually install it or whatever it is I need to do to write code in it. I downloaded node.js and I have v12.18.3 installed as well as NPM 6.14.6 installed as well, but every time I try to type in the commands in the create-react-app installation method mentioned on many websites I get an error message saying: Uncaught SyntaxError: Invalid or unexpected token. Am I supposed to be typing directly into node? I have Visual code studio installed am I supposed to use that in some way? I see there’s a github repository for create-react-app, does this mean I have to download it to my pc to run it? Does React just have a CDN I can use to skip all this?
create-react-app is the command to create the react app.
But it is not necessary to install it to create-react-app.
Best thing you have to do is,
npx create-react-app <app-name-here>
This makes install create-react-app install in the runtime of the command with using npx.
As an example,
npx create-react-app my_app
Try this.
Best regards.
Use following command and let's get start:
npx create-react-app <app-name>
Ex:
npx create-react-app demo-app
npx create-react-app name-of-app
then press "Enter" and let the magic begins
you can create a react project by simply typing
npx create-react-app on cmd on the path that you need to create react app.

create-react-app pausing indefinitely rather than creating a react app

I have started with react.js recently. I am currently using node -v : v12.18.1 and In order to make a react app I am using:
npx create-react-app my-app
But on running this command something unexpected happens. My command prompt gets paused indefinitely as soon as things related to npm audit are shown on the screen
Click here to see the output
I have tried waiting for an hour but nothing happened. As a result, I have to force stop the process by using Ctrl+C
I have tried the following things:
1: clearing cache using npm cache clean --force and verifying it using npm cache verify
2: I have even tried re-installing node.js and uninstalling create-react-app using npm uninstall -g create-react-app and then installing it again.
3:I have even tried using yarn and npm but a similar error was shown in them too.
Try the following command:
npm install npm#latest -g
Then close terminal.
Open a new terminal window and try npx create-react-app my_app
This problem arises due to the stalling of the command prompt. As mentioned in the question the terminal hangs and only node_modules folder is created and at the end most of the users end up terminating the process.
In order to solve this problem I opened the task manager and found a leaf symbol infront of my command propmt. However having this symbol is not a necessary condition.
Img: Showing a suspended process
Later I found that the process was suspended by the system due to some reasons.
I traced it down in the Resource monitor and resumed it.
Img:Resuming a process
Happy Hacking !!!

Npm start doesnt work after I create a react app

I'm following a youtube react tutorial and what I did was npx create-react-app my-app Once this was done I cd'ed into my-app and tried to npm start like the tutorial showed. I got an error saying
-npm ERR! missing script: start
I also saw that the person in the tutorial had a public and a source folder. I only have the node_modules folder and package-lock.json and package.json. Why am I missing the public and source folders and why cant I npm start?
I had the same issue and solved it running : npm uninstall -g create-react-app.
Thanks to the -g (aka 'global' attribute) you can run this terminal command no matter the directory you find yourself.
Then go in the directory you would like to find your project and run npx create-react-app my-app again!

Resources