Search code examples
node.jsreactjsmacosnpmcreate-react-app

'npm start' with create-react-app not launching server on macOS


After creating an app using create-react-app, I tried using 'npm start' to run the app. Although it doesn't throw an error, it also doesn't launch the server.

For a little context, this command was working a few weeks ago just fine. It would spit out a little bit of text into the console and then lauch a browser at localhost:3000. Since then, I ran into a bug between node and React Native and downgraded to node v10 in order to avoid the bug (although Im currently using node v13). Since then, I have reinstalled node (via homebrew) and reinstalled creact-react-app.

Below are my current specifications

macOS v10.14.5

node v13.5.0

npm v6.13.4

create-react-app v3.3.0

Below is my package.json file

{
  "name": "testing",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.4.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-scripts": "3.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

I have tried using npm-install-missing to check for missing dependancies. I have also tried removing node modules using 'rm -rf node_modules' and then running 'npm install'.

I am unsure where to go from here. I thought that since 'npm start' calls 'react-scripts start', maybe there was an issue within react-scripts. However, react-scripts should have been reinstalled with create-react-app so im not sure. I am happy to provide more information if there is anything else that I am missing. Thanks!

Edit: When I deleted a previous version of node, I went though and deleted files manulally so that I could reinstall node using homebrew. I thought that I deleted all the proper files, however, if I didn't, could that play a role in this?


Solution

  • Go to your

    ~\.npmrc

    file and see if it contains

    ignore-scripts=true
    

    I dont know how or why this was set but it offered many hours of headaches.