1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

一番最初に知りたかった、Next.jsのセットアップ

Last updated at Posted at 2025-02-12

はじめに

Next.js の環境構築をしようとするときに、「なんだかんだ毎回調べてるし、まとめておけば後で楽なんじゃ!」とひらめいたので、備忘録もかねて書き始めます。

Next.jsのインストール

これだけで自動インストールしてくれます。めっちゃ楽です!

npx create-next-app@latest <Project Name>

いろいろ選ぶところありますが、僕はこんな感じです。
(そろそろ AppRooterを使ってみたいを、一年間繰り返してますw)

✔ Would you like to use TypeScript? … Yes
✔ Would you like to use ESLint? … Yes
✔ Would you like to use Tailwind CSS? … Yes
✔ Would you like your code inside a `src/` directory? … Yes
✔ Would you like to use App Router? (recommended) … No
✔ Would you like to use Turbopack for `next dev`? … Yes
✔ Would you like to customize the import alias (`@/*` by default)? … No

(とりあえず) 開発サーバに火を灯してみる!

作成されたディレクトリで、開発サーバーを起動してみる。

npm run dev

以下のURLに接続すると...。

http://localhost:3000

こんな感じになれば成功です!
image.png

いろいろな必要なライブラリを入れていく。

ここら辺はご自身で取捨選択しちゃってください!

  • headless-ui (UIライブラリ)
npm install @headlessui/react
  • heroicons (便利なアイコンライブラリ)
npm install @heroicons/react
  • next-themes (ダークモード対応)
npm install next-themes

さいごに

ご覧いただきありがとうございました!
もしお気づきの点があれば、ぜひコメントで教えていただければ幸いです!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?