0

index.js: const port = process.env.PORT || 3000;

server package.json:

    "start": "node index.js",
    "server": "nodemon index.js",
    "client": "npm start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\""
  },

client package.json:

"proxy": "http://localhost:5000",

I am starting it with npm run dev

Any idea where the problem might be?

error:

Error: Cannot find module '.../index.js'

oneone
  • 32
  • 1
  • 9

2 Answers2

1

try to map the subpath of the client project:

{
    "start": "node index.js",
    "server": "nodemon index.js",
    "client": "cd client && npm start",
    "dev": "concurrently \"npm run server\" \"npm run client\""
},
Joao Polo
  • 2,153
  • 1
  • 17
  • 26
0

as I have had application and server folders, the same problems appeared. And I resolved it by giving the path --> "application": "cd ../ && npm start --prefix application"

{
  "server": "nodemon server/app.js",
  "application": "cd ../ && npm start --prefix application",
  "dev": "concurrently \"npm run server\"  \"npm run application\" "
}