Skip to content
Discussion options

You must be logged in to vote

You need to fix how you access express and next, for example:

const express = require("./client2/node_modules/express");
const next = require("./client2/node_modules/next");

const dev = process.env.NODE_ENV !== "production";
const app = next({ dev, dir: "./client2" });
const handle = app.getRequestHandler();

app.prepare().then(() => {
  const server = express();

  server.get("*", (req, res) => {
    return handle(req, res);
  });

  server.listen(3000, (err) => {
    if (err) throw err;
    console.log("> Ready on http://localhost:3000");
  });
});

Notice the first two lines. Since neither express, or next, are native Node packages, the Node.js module resolution algorithm won't find th…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@muhammedalibilgin
Comment options

@muhammedalibilgin
Comment options

Comment options

You must be logged in to vote
1 reply
@muhammedalibilgin
Comment options

Answer selected by muhammedalibilgin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants