CentOS Stream 9
Sponsored Link

Next.js : インストール2022/06/28

React ベースの Web 開発フレームワーク Next.js のインストールです。
[2] 任意の一般ユーザーで Next.js テストアプリケーションを作成します。
[cent@dlp ~]$
mkdir testproject

[cent@dlp ~]$
cd testproject
# Next.js アプリケーション [test-app] 作成

[cent@dlp testproject]$
npx create-next-app test-app

Need to install the following packages:
Ok to proceed? (y) y
Creating a new Next.js app in /home/cent/testproject/test-app.

Using npm.

Installing dependencies:
- react
- react-dom
- next


Success! Created test-app at /home/cent/testproject/test-app
Inside that directory, you can run several commands:

  npm run dev
    Starts the development server.

  npm run build
    Builds the app for production.

  npm start
    Runs the built app in production mode.

We suggest that you begin by typing:

  cd test-app
  npm run dev

[cent@dlp testproject]$
cd test-app
# 開発用サーバーを起動

[cent@dlp test-app]$
npm run dev

> test-app@0.1.0 dev
> next dev

ready - started server on, url: http://localhost:3000
wait  - compiling...
event - compiled client and server successfully in 3.1s (125 modules)
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:

# ビルド & プロダクションモードでサーバーを起動

[cent@dlp test-app]$
npm run build

> test-app@0.1.0 build
> next build

info  - Checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully
info  - Collecting page data
info  - Generating static pages (3/3)
info  - Finalizing page optimization


  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
  (Static)  automatically rendered as static HTML (uses no initial props)

[cent@dlp test-app]$ npm start 

> test-app@0.1.0 start
> next start

ready - started server on, url: http://localhost:3000
  任意のクライアントコンピューターで表示された URL に Web アクセスして、以下のようなページが表示されれば OK です。