after create react app , npm start is not working , each time getting different errors

Viewed 83

I tried npm init, update, cache clearing, node js uninstalled and installed, but nothing helped

After create react app, npm start is not working, each time getting different errors:

D:\Downloads in Data drive\SourceCodes\Full Stack Web Development\NodeJs\Project A\client\node_modules\cross-spawn\lib\enoent.js:1
$→��m��mo�L�D��;�%g�?w��ŷ↓�▬��ovH0��a�5��*�ؒ��l͛�S�iy☺�r�O7����%L]��%��∟�hk
 ^

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1033:15)
    at Module._compile (node:internal/modules/cjs/loader:1069:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\Downloads in Data drive\SourceCodes\Full Stack Web Development\NodeJs\Project A\client\node_modules\cross-spawn\index.js:5:16)   
    at Module._compile (node:internal/modules/cjs/loader:1105:14)





D:\Downloads in Data drive\SourceCodes\Full Stack Web Development\NodeJs\Project B\client copy\node_modules\path-to-regexp\index.js:1
$→��m��mo�L�D��;�%g�?w��ŷ↓�▬��ovH0��a�5��*�ؒ��l͛�S�iy☺�r�O7����%L]��%��∟�hk
 ^

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1033:15)
    at Module._compile (node:internal/modules/cjs/loader:1069:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\Downloads in Data drive\SourceCodes\Full Stack Web Development\NodeJs\Project B\client copy\node_modules\express\lib\router\layer.js:16:18)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)

My Package.json

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.2.0",
    "@testing-library/user-event": "^13.5.0",
    "ajv-dist": "^8.11.0",
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.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"
    ]
  }
}
1 Answers

Go to Command Prompt and locate the directory where you installed Node JS and run this command: node --version. If it shows the version that you have installed, then run this command: npm --version. If it does not show the version then something is wrong.

Go to Node JS Official Website and download the Long Term Support(LTS) version of Node JS e.g 16.15.0 (according to the posting time of the answer). Then install it and run the previous commands e.g. node --version & npm --version.

The error should be gone.

Related