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

[ERROR] [vike][Warning] process.env.NODE_ENV==="undefined" #490

Open
br0wsa opened this issue Mar 19, 2025 · 0 comments
Open

[ERROR] [vike][Warning] process.env.NODE_ENV==="undefined" #490

br0wsa opened this issue Mar 19, 2025 · 0 comments
Assignees
Labels
bug Something isn't working low-prio

Comments

@br0wsa
Copy link

br0wsa commented Mar 19, 2025

Describe the bug
On preview, the build indicates that the NODE_ENV environment variable is set as the string "undefined" instead of being undefined or "development"/"production".

[ERROR] [vike][Warning] process.env.NODE_ENV==="undefined" which is unexpected: process.env.NODE_ENV is allowed to be the *value* undefined (i.e. process.env.NODE_ENV===undefined) but it shouldn't be the *string* "undefined" https://vike.dev/NODE_ENV

Expected behavior

Setting process.env.NODE_ENV is a widespread convention to tell tools whether your app is being run in development or production.

It's important to respect the following convention: many tools run erroneously otherwise.

📌In development:

  • Make sure process.env.NODE_ENV is one of these values: ['development', 'dev', '', undefined].
  • If you use a server, make sure to use createDevMiddleware() for adding the development middleware to your server.

📌In production (and staging):

  • Make sure process.env.NODE_ENV is a value different than ['development', 'dev', '', undefined].

Screenshots
Image

Additional context

  • OS: Ubuntu (latest version)
  • PC: Aspire A315-23
  • Package Manager: pnpm
  • Stack:
    • Cloudflare Workers (via Wrangler)
    • Mantine
    • Prettier, ESLint
    • Sentry
    • React
@br0wsa br0wsa added the bug Something isn't working label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low-prio
Projects
None yet
Development

No branches or pull requests

2 participants