question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom server with express not working in production mode

See original GitHub issue

I was running my project with express, then I saw an issue in production mode so I replicated the custom-server-express example and the same issue was there:

issue

(using nextjs beta 36) It is only happening with npm run start. everything seems to be fine in dev.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
reelcommented, Jul 4, 2017

The reason is next start only runs the next.js part…

You should next build then start with NODE_ENV=production node server.js

You can also trigger the build programmatically from dist/server/build

2reactions
timneutkenscommented, Jul 4, 2017

@reel FYI https://github.com/zeit/next.js/issues/1326#issuecomment-283563364 has been fixed 👌 If there is no build it’ll show a warning when using custom server to 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem to deploy Next App and Express API as a custom server
5. I change the application mode to development and then this shows up. I feel hopeless, and don't know what to do anymore....
Read more >
node.js - Express routes not working on production server
I am struggling to control the flow using a Node Express application on my production server. The home page displays "homepage" but the ......
Read more >
Express Tutorial Part 7: Deploying to production
This tutorial provides some guidance on your options for choosing a hosting site, a brief overview of what you need to do in...
Read more >
Advanced Features: Custom Server - Next.js
If your project uses a custom server, this behavior may result in the same content being served from multiple paths, which can present...
Read more >
Set Up Next.js with a Custom Express Server + Typescript
The problem comes from tsconfig.json , there is a line "module": "esnext" . ... Before spinning up the server in production mode, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found