basyura's blog


Next.js 入門 2


import Link from "next/link";

export default function IndexPage({ param }) {
  return (
      Hello {param.Hello}.{" "}
      <Link href="/about">

export async function getServerSideProps() {
  const res = await fetch(`http://localhost:1325/api/echo`);
  const data = await res.json();
  return { props: { param: data } };


$ npx next export

Error occurred prerendering page "/". Read more:
Error: Error for page /: pages with `getServerSideProps` can not be exported. See more info here:

The getServerSideProps lifecycle is not compatible with next export, so you'll need to use next start or a serverless deployment.

ダメなんか・・・。node.js でサーバー動かせばいいんだけど諸事情にやりづらい環境なので辛い。

windows service で動かす方法があったのでメモ。