LoginSignup
15
20

More than 3 years have passed since last update.

Next.jsのセットアップ手順

Last updated at Posted at 2020-01-16

ディレクトリ作成

mkdir sample_app
cd sample_app

node_modules初期化

npm init -y
  • これでpackage.jsonを作ってくれる

Next.jsインストール

npm install --save next react react-dom

package.jsonのscriptsにコマンドを追加

"dev": "next -p 3001",
"build": "next build",
"start": "next start"
  • ポート番号3000だと他アプリと被りやすいので別ポートに変更

サンプルページ作成

mkdir pages
vi pages/index.js
export default () => <div>Welcome to next.js!</div>

起動

npm run dev

参考記事

15
20
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
15
20