skip to Main Content

npm start error image

Previously, npm start used to run properly. I shifted my project folder in new folder then error started to occur.
My script has
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},

2

Answers


  1. You have several package.json files, one for the server (root level) and another in the StartingProject folder.

    Try to open only the folder with your React Native project in VS Code.

    Also, you can navigate using the terminal into your StartingProject folder: cd StartingProject

    Login or Signup to reply.
  2. Solution 1 :
    It appears that your package may not have a start script defined.There isn’t a server.js file in your project or in the json file.

    If your package contains a server.js file in the root, npm will automatically set the start command to node server.js.

    You can either add the following to your package or rename your application script to server.js.JSON

    "scripts": {
        "start": "node your-script.js"
    }
    

    you could just run node your-script.js directly

    if u know more about then hit this link : https://docs.npmjs.com/misc/scripts#default-values

    Solution 2 :
    add this inside package.json file before closing the "}"

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

    Solution 3 :
    public, src,and scripts folder not created while using create-react-app
    or
    https://codedamn.com/news/javascript/how-to-fix-npm-err

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search