How to run react on browser?

Viewed 172

I am new to react framework and I am trying to make a web app with the help of Tailwind CSS. it runs on the browser when I followed these steps :

npx create-react-app my-project
cd my-project
npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
npm install @craco/craco
npx tailwindcss-cli@latest init
npm start

but when I reopen the editor and run the command npm start in the terminal, the following error shows:

PS D:\react1> npm start
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DELL\AppData\Local\npm-cache\_logs\2021-07-12T09_16_22_570Z-debug.log

Please help me where i am wrong. I followed this page for the installation of react with tailwind https://tailwindcss.com/docs/guides/create-react-app enter image description here

3 Answers

First do npm i react-scripts after that replace the current scripts with this:

"scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
    },

Then restart your visual studio code, and run in terminal: npm start

I got this error because I was not running the command npm start in a particular project directory. Like my project was in: D://React/react1 and I was running the command in D://React

Related