a month ago
I'm attemping a migration of a Next.js app from Vercel to Railway but running into issues. I'm using a "Deploy via GitHub" approach. Onboarding was generally very smooth but the deployed app won't run. In the Build logs I see: You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
And the app itself fails with:TypeError: (0 , react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV) is not a function
at App (pages/_app.tsx:9:4)
I tried changing the build command from next build
to NODE_ENV=production next build
but that didn't make a difference.
I tried changing the start command from next
to NODE_ENV=production next
but that also didn't make a difference.
I tried adding a NODE_ENV = production
Variable directly in the Railway service configuration, but that also didn't make any difference.
I wasn't able to find any other support threads with this similar issue so I'm a bit stuck on what could be going wrong.
4 Replies
a month ago
Hey! Could you try:
Remove
NODE_ENV=production
from build/start commandSet
NODE_ENV=production
as a service variableSwitch from Nixpacks to Railpack in Service Settings -> Build -> Builder
Status changed to Awaiting User Response Railway • about 1 month ago
ray-chen
Hey! Could you try:Remove NODE_ENV=production from build/start commandSet NODE_ENV=production as a service variableSwitch from Nixpacks to Railpack in Service Settings -> Build -> Builder
a month ago
Thanks for the quick response. Unfortunately, no luck. Same error. If I change my start command to echo $NODE_ENV && next
it prints:> echo $NODE_ENV && next
production
You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
▲ Next.js 15.3.5
- Local: http://localhost:8080
- Network: http://10.250.20.171:8080
- Environments: .env
TypeError: (0 , react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV) is not a function
at App (pages/_app.tsx:9:4)
I can reproduce the issue locally on my Mac if I use NODE_ENV=production && next
. I see the same warning and then the same jsxDEV
error. The solution locally is to remove NODE_ENV
entirely and leave it empty. I'm trying to find a way to do the same on Railway, but it seems to be setting NODE_ENV=production
even though it's not in my .env, or my service variables, or my start commands.
Status changed to Awaiting Railway Response Railway • about 1 month ago
evhaus
Thanks for the quick response. Unfortunately, no luck. Same error. If I change my start command to echo $NODE_ENV && next it prints:> echo $NODE_ENV && nextproductionYou are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env▲ Next.js 15.3.5- Local: http://localhost:8080- Network: http://10.250.20.171:8080- Environments: .envTypeError: (0 , react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV) is not a functionat App (pages/_app.tsx:9:4)I can reproduce the issue locally on my Mac if I use NODE_ENV=production && next. I see the same warning and then the same jsxDEV error. The solution locally is to remove NODE_ENV entirely and leave it empty. I'm trying to find a way to do the same on Railway, but it seems to be setting NODE_ENV=production even though it's not in my .env, or my service variables, or my start commands.
a month ago
I found a somewhat hacky fix -- adding a NODE_ENV
service variable with an empty string in Railway. Would still like to know where the production
value comes from though.
a month ago
Most likely from Nixpacks -
https://nixpacks.com/docs/providers/node#environment-variables
Status changed to Awaiting User Response Railway • about 1 month ago
Status changed to Solved evhaus • 30 days ago