CentOS Stream 10
Sponsored Link

Next.js : インストール2025/02/10

 

React ベースの Web 開発フレームワーク Next.js のインストールです。

[1]

こちらを参考に Node.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

✓ Would you like to use TypeScript? ... No / Yes
✓ Would you like to use ESLint? ... No / Yes
✓ Would you like to use Tailwind CSS? ... No / Yes
✓ Would you like your code inside a `src/` directory? ... No / Yes
✓ Would you like to use App Router? (recommended) ... No / Yes
✓ Would you like to use Turbopack for `next dev`? ... No / Yes
✓ Would you like to customize the import alias (`@/*` by default)? ... No / Yes
Creating a new Next.js app in /home/cent/testproject/test-app.

Using npm.

Initializing project with template: app-tw


Installing dependencies:
- react
- react-dom
- next

Installing devDependencies:
- typescript
- @types/node
- @types/react
- @types/react-dom
- postcss
- tailwindcss
- eslint
- eslint-config-next
- @eslint/eslintrc

.....
.....

added 376 packages, and audited 377 packages in 22s

143 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Success! Created test-app at /home/cent/testproject/test-app

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

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


> test-app@0.1.0 dev
> next dev --turbopack

   ▲ Next.js 15.1.6 (Turbopack)
   - Local:        http://localhost:3000
   - Network:      http://10.0.0.30:3000

 ✓ Starting...
 ✓ Ready in 907ms


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

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


.....
.....

○  (Static)  prerendered as static content

[cent@dlp test-app]$ npm start 

> test-app@0.1.0 start
> next start

   ▲ Next.js 15.1.6
   - Local:        http://localhost:3000
   - Network:      http://10.0.0.30:3000

 ✓ Starting...
 ✓ Ready in 365ms
  任意のクライアントコンピューターで表示された URL に Web アクセスして、以下のようなページが表示されれば OK です。
関連コンテンツ