Open LVSSandeepKumar opened 3 months ago
The error occurs because Windows doesn't support setting environment variables in the same way as Unix-based systems. To make this work cross-platform, you can use the cross-env package, which allows you to set environment variables across different operating systems in a consistent way.
Steps to Fix:
1. Install cross-env
npm install cross-env
2.Update the start & dev script in your package.json:
"scripts": { "start": "cross-env NODE_ENV=production node backend/server.js", "dev": "cross-env NODE_ENV=development nodemon backend/server.js" }
3. Try npm run start in your terminal
npm run start
ok the above solution works just make sure you update both Json.packages and by both I mean the internal and the external package
When I added NODE_ENV in build and start commands in package.json as you suggested in the last module,
"scripts": { "dev": "NODE_ENV=development nodemon backend/server.js", "start": "NODE_ENV=production node backend/server.js", "build": "npm install && npm install --prefix frontend && npm run build --prefix frontend" },
I faced this error...
` npm run start
'NODE_ENV' is not recognized as an internal or external command, operable program or batch file.`