Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run start: 'NODE_ENV' is not recognized as an internal or external command, operable program or batch file. #105

Closed
borzaka opened this issue Dec 29, 2023 · 1 comment · Fixed by #117

Comments

@borzaka
Copy link

borzaka commented Dec 29, 2023

I have created a Vite Express app with create-vite-express. React + TS. I'am on Windows.

When I run npm run start, I get this error:

'NODE_ENV' is not recognized as an internal or external command, operable program or batch file.

"start": "NODE_ENV=production tsx src/server/main.ts",

My solution: install cross-env:

  • npm install --save-dev cross-env
  • create a new script called preview, and keep start unchanged
  • "preview": "cross-env NODE_ENV=production tsx src/server/main.ts",
@szymmis
Copy link
Owner

szymmis commented Feb 4, 2024

Hi @borzaka, quite a long time since you posted this issue but I wanted to thank you for pointing that out and providing solution right away! The issue was resolved in the newest version of create-vite-express and everything should work out of the box even on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants