ReactJS or React is a JavaScript library to create and design interactive user interfaces. Following is a list of steps/commands to get started with ReactJS/ React App.
- npm install -g create-react-app
- CD into the folder where you want to create the react app
- To create a react app, run the command: create-react-app myapp
- A react app (named reactapp) is created with default files and folders
- To run the app on localhost, run the command: npm start
- To serve the build of the app we can use the serve package. To install it, run the command: npm install -g serve
- To create a build for the app, run the command npm run build
- To serve the build of the app, run the command: serve -s build
Issue:
Error message like “events.js:174 throw er; // Unhandled ‘error’ event ^ Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit… “
Solution:
- Go into control panel -> System -> Advanced system Settings -> Environment Variables
- Edit PATH variable
- On edit screen, click the New button and add C:\Windows\system32 there
- Then click Ok and restart the system
- Run the app again
References: