Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm start command not working, when I try to run my React application

React is installed properly and everything else works, except when I try to run "npm start" in the terminal, it gives me the following error.

Picture of the error

Here's my package.json code:

        {
      "name": "r3-ui",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        "@testing-library/jest-dom": "^5.11.6",
        "@testing-library/react": "^11.2.2",
        "@testing-library/user-event": "^12.2.2",
        "react": "^17.0.1",
        "react-dom": "^17.0.1",
        "react-scripts": "4.0.1",
        "web-vitals": "^0.2.4"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
      "eslintConfig": {
        "extends": [
          "react-app",
          "react-app/jest"
        ]
      },
      "browserslist": {
        "production": [
          ">0.2%",
          "not dead",
          "not op_mini all"
        ],
        "development": [
          "last 1 chrome version",
          "last 1 firefox version",
          "last 1 safari version"
        ]
      }
    }
like image 211
Mx. Avatar asked Oct 26 '22 16:10

Mx.


People also ask

Why npm start command is not working?

Check the ignore-script config If you see the start script is present inside your package. json file but still can't run the script, you need to check the console output. If there's no output at all, then you may have the ignore-scripts npm configuration set to true .

Why my React app is not running?

If you really need create-react-app , you might need to reinstall Node and reconfigure your dependencies to ensure you have a fresh start with Node, npm, npx, and the like. This is a good resource for updating and reinstalling Node.

How does React npm start work?

With the start argument, NPM will begin the process to make a development server available for your React application. Here's a list of tasks for this script: Set the build environment into development for Node and Babel. Ensure environment variables are read for the build process.


1 Answers

Do not use & when naming the directory on Windows. Rename UI & Web Design into UI_Web_Design. Anything after the & is treated as a command.

After changing the name of the directory run npm start.

like image 97
yudhiesh Avatar answered Nov 17 '22 07:11

yudhiesh