skip to Main Content

In package.json file I have these scripts:

"scripts": {
    "server": "json-server --watch db.json --port 5000",
    "client": "npm start --prefix client",
    "client-build": "npm run-script build --prefix client",
    "chat": "nodemon index.js",
    "dev": "concurrently "npm run server" "npm run client"",
    "build": "concurrently "npm run server" "npm run client-build" "npm run client""
  },

And I use the "npm run dev" command to run server and client at the same time.
The server runs, but an error occurs with the client:

react-scripts start
[1]
[1] node:internal/modules/cjs/loader:1051
[1]   throw err;
[1]   ^
[1]
[1] Error: Cannot find module 'C:UsersehsanDesktopPDEITaghvimsogo_react_20231127clientnode_modulesreact-scriptsbinreact-scripts.js'
[1]     at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
[1]     at Module._load (node:internal/modules/cjs/loader:901:27)
[1]     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
[1]     at node:internal/main/run_main_module:23:47 {
[1]   code: 'MODULE_NOT_FOUND',
[1]   requireStack: []
[1] }
[1]
[1] Node.js v20.9.0

I cleared the npm cache, deleted and reinstalled the node_modules folder, even installed the react-scripts package separately, but none of it worked.

2

Answers


  1. how about npm i again before check the react-scripts 🙂

    Login or Signup to reply.
  2. There is several solution to start your application.

    1. Run npm run build first, and do npm run start
    2. You might need to install the package npm i react-scripts
    3. If you are on window machine, replace your capital "i" I in your project path into something different.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search