Next.js ํ๋ก์ ํธ ์์ฑ์ ์ํ ๊ฐ๋ฐ ํ๊ฒฝ ๋ฐ ์ค์น
Mac OS Sequoia 15.1.1 (zsh shell)
Next.js 14.2.5
Node.js 18.20.5 LTS
Typescript 5.7.2
๋งฅ ์ธํ ์นฉ ์ ์ฉ Visual Studio Code 1.96 ๋ฒ์ (2024๋ 12์ 15์ผ ๊ธฐ์ค) ์ง์ ์ค์น ๋ฐฉ๋ฒ
https://code.visualstudio.com/download
Download Visual Studio Code - Mac, Linux, Windows
Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web and cloud applications.
code.visualstudio.com
ํฐ๋ฏธ๋์์ ์๋ ๋ช ๋ น์ด๋ฅผ ์คํํ์ฌ Visual Studio Code ํตํฉ๊ฐ๋ฐํ๊ฒฝ ๋๊ตฌ(IDE)๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํฉ๋๋ค.
code --version
์ค์น๋์ด ์์ผ๋ฉด Visual Studio Code์ ๋ฒ์ ์ ๋ณด๊ฐ ์ถ๋ ฅ๋ฉ๋๋ค.
1.96.0
์ค์น๋์ด ์์ง ์์ผ๋ฉด ์๋์ ๊ฐ์ ๋ฉ์์ง๊ฐ ๋ํ๋ฉ๋๋ค.
zsh: command not found: code
Visual Studio Code๊ฐ ์ค์น๋์ง ์์ ๊ฒฝ์ฐ Homebrew๋ฅผ ์ฌ์ฉํ์ฌ ์ค์น
brew install --cask visual-studio-code
Visual Studio Code ์คํ ํ์ธ
Visual Studio Code ์ค์น๊ฐ ์๋ฃ๋๋ฉด ํฐ๋ฏธ๋์์ Visual Studio Code๋ฅผ ์ด์ด ํ์ธํ ์ ์์ต๋๋ค. ์ค์น ๋ฐ ํ์ธ์ด ์๋ฃ๋๋ฉด Visual Studio Code๋ฅผ ์ฌ์ฉํด ๊ฐ๋ฐ์ ์์ํ ์ ์์ต๋๋ค.
# ํ์ฌ ๋๋ ํ ๋ฆฌ์์ VS Code ์คํ
code .
NVM(Node Version Manager) ํ์ฉํ Node.js 18.20.5 LTS ์ค์น
https://nodejs.org/en/download/package-manager
Node.js — Download Node.js®
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
nodejs.org
# nvm (Node Version Manager) ์ค์น
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# Node.js ์ค์น
nvm install 18
# Node.js ๋ฒ์ 18.20.5 ํ์ธ
node -v
# npm ๋ฒ์ ํ์ธ
npm -v
NVM (Node Version Manager)๋ Node.js์ ๋ฒ์ ์ ๊ด๋ฆฌํ๋ ๋๊ตฌ์ ๋๋ค. ํ๋์ ์์คํ ์์ ์ฌ๋ฌ Node.js ๋ฒ์ ์ ์ค์นํ๊ณ , ํ์์ ๋ฐ๋ผ ๊ฐ๋จํ ๋ช ๋ น์ผ๋ก ๋ฒ์ ์ ์ ํํด์ ์ ์ฐํ๊ฒ ๊ฐ๋ฐ์ ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, Node Version Manager ํ์ฉํ Node.js ๋ฒ์ ์ ์๋์ ๊ฐ์ด ์ค์น ํ๋ค๊ณ ๊ฐ์ ์ ํด๋ณด๊ฒ ์ต๋๋ค. (2024๋ 12์ 15์ผ ๊ธฐ์ค )
- v22.12.0 LTS
- v20.18.1 LTS
- v18.20.5 LTS
nvm์ ํตํด ์ค์น๋ Node.js ๋ฒ์ ๋ชฉ๋ก๊ณผ ํ์ฌ ์ฌ์ฉ ์ค์ธ ๋ฒ์ ์ ํ์ธํ ์ ์๊ณ , ์ต์ ๊ฐ๋ฐ ํ๊ฒฝ ํ ์คํธ ๋ฐ ํธํ์ฑ ์ฌ๋ถ์ ๋ฐ๋ผ Node.js ๋ฒ์ ์ ์ ํ ๋ฐ ๊ด๋ฆฌํ ์ ์์ต๋๋ค.
# ํ์ธ
nvm list
# ๊ฒฐ๊ณผ
-> v18.20.5
v20.18.1
v22.12.0
default -> v22 (-> v22.12.0)
node -> stable (-> v22.12.0) (default)
# ๋ฒ์ ์ ํ
nvm use 20
# ๊ฒฐ๊ณผ
v18.20.5
-> v20.18.1
v22.12.0
default -> v22 (-> v22.12.0)
node -> stable (-> v22.12.0) (default)
Typescript ์ ์ญ ์ค์น
npm i -g typescript
Typescript ์ค์น ํ์ธ
# ํ์ธ
tsc -v
# ๊ฒฐ๊ณผ
Version 5.7.2
Next.js 14 ํ๋ก์ ํธ ์์ฑ
npx create-next-app@14.2.5 to-do-list
Need to install the following packages:
create-next-app@14.2.5
Ok to proceed? (y)
โ 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 to use `src/` directory? … No / Yes
โ Would you like to use App Router? (recommended) … No / Yes
โ Would you like to customize the default import alias (@/*)? › No / Yes
Success! Created to-do-list
Next.js 14 ํ๋ก์ ํธ ์คํ
cd to-do-list
# ์คํ
npm run dev
๋๊ธ