Reputation: 42
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'
Upvotes: 0
Views: 1765
Reputation: 72
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\" "
}
Upvotes: 0
Reputation: 2163
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\""
},
Upvotes: 1