0

I setup a new React App and installed npm install -g create-react-app.

I tried to reinstall the node packages, removed the package-lock.json, cleared my npm cache with npm cache clean --force but nothing work.

I saw in a github Issue that is already closed that they look with npm ls react and that:

Marcelo-Rizzardo:test marcelo$ npm ls react
test@0.1.0 /Users/marcelo/Development/test
├── react@16.0.0
└─┬ react-scripts@1.0.14
  └─┬ react-dev-utils@4.1.0
    └─┬ react-error-overlay@2.0.2
      └── react@16.0.0  deduped

If im doing it and it will return that:

$ npm ls react
sosa-server@0.1.0 F:\Tim\Dokumente\Coding\sosa-server
`-- react@16.8.6 

my package.json

{
  "name": "sosa-server",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@types/jest": "24.0.14",
    "@types/node": "12.0.8",
    "@types/react": "16.8.20",
    "@types/react-dom": "16.8.4",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-scripts": "^3.0.1",
    "typescript": "3.5.2"
  },
  "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"
    ]
  }
}

fyi im using VSCode 1.35.1 with the git bash.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Creed
  • 1
  • 3

2 Answers2

0

I remember having this error once but cannot reproduce the results again. I am sure you have read through this answer already: sh: react-scripts: command not found after running npm start. But there still might be two things you can try from this.

1) Could it be that you ran your commands in incorrect directories? Meaning you ran your commands (npm install, npm run start) in the client folder instead of globally running the commands (might not apply to you, but I set up my react projects with a sub client folder to do all the front end). And sorry I am having a bit of trouble reading the tree you provided at the top to know what's going on.

2) update npm to latest version and then delete node module directory and then run npm install.

Acy
  • 589
  • 2
  • 9
  • 25
  • Its an fresh React directory created with ``create-react-app sosa-server --typescript` and edit nothing on the directory. Also i removed my whole nodejs folder and installed nodejs version 12.4.0 – Creed Jun 15 '19 at 18:46
0

I was having this issue because the npm install command was timing out due to a timeout restriction included as part of node version 12 (which includes npm). I updated my node version to the most current one (v14.5.0) and the problem went away.

Latin Warrior
  • 902
  • 11
  • 14