How to run React JS app in Visual studio code tutorial
In this tutorial, we will learn how to run a React JS app in Visual Studio Code. Visual Studio Code is a popular text editor among web developers and it provides great support for building and running React applications. We will also cover the steps to download and install React in VS Code.
Download and install React in VS Code
The first step is to download and install Node.js, which includes npm (Node Package Manager). You can download Node.js from the official website and follow the installation instructions. Once Node.js is installed, you can use npm to install create-react-app, which is a tool that allows you to create a new React app with just one line of code.
To install create-react-app, open a terminal or command prompt and run the following command:
npm install -g create-react-app
This will install create-react-app globally on your system, allowing you to use it from any directory. Once create-react-app is installed, you can create a new React app by running the following command:
npx create-react-app my-React-app
Replace ‘my-React-app’ with the name you want for your app. This will create a new directory with all the files and dependencies you need for your React app.
Run React app in Visual Studio Code
Now that you have a React app created, you can open it in Visual Studio Code. Open Visual Studio Code and go to File -> Open Folder, then select the folder where your React app is located.
Once the folder is open in Visual Studio Code, open a new terminal by going to Terminal -> New Terminal. In the terminal, navigate to the directory of your React app and run the following command to start the app:
npm start
This will start a development server for your React app and open it in your default web browser. You can now make changes to your app and see them reflected in real-time in the browser.
That’s it! You have now successfully downloaded, installed, and run a React app in Visual Studio Code. Happy coding!
Check description for the commands used
npx : The term 'npx' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ npx create-react-app my-app
+ ~~~
+ CategoryInfo : ObjectNotFound: (npx:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
@unitedtoptech6288
why do you need a node js when we're talking about react?
I installed the extension but when I run a react program it just show code language not supported or defined.. Is there any solution for it
Thank you very much man, you literaly saved my school project.
sir im getting npm error
PS C:UsersHPDesktopultimate-react-course-main> npx create-react-app@5 pizza-menu
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:UsersHPAppDataRoamingnpm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:UsersHPAppDataRoamingnpm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
i'm getting this error how to solve it ?
thanks bro
Thank you sir♥️
very usefull
❤
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
changed 67 packages in 3s
5 packages are looking for funding
run `npm fund` for details
PS C:UsersDellOneDriveDesktopreact project>
i am facing this while running the command, how to solve?
Great video. Very easy to follow the steps. 👌👌
it saying "npx not recognised"
Thanks for Sharing:)
best , helped a lot trying to this for 3 hours 😭😭😭
Very good job! Loved the tutorial
thankyou man
7:52 im getting some errors 😢
When im trying to create new react app, i got this type of error , what will i do?
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:UsersjagadAppDataRoamingnpm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:UsersjagadAppDataRoamingnpm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in: C:UsersjagadAppDataLocalnpm-cache_logs2023-09-21T06_06_20_921Z-debug-0.log