Node.js 用 .gitignore
Node.js 用の除外ルール 63 件。そのままリポジトリにコピーして使えます。
Chrome の V8 エンジン上に構築された JavaScript ランタイム
Node.js 用 .gitignore の完全版
# LFGitignore によって生成 - https://lfgitignore.com
# 作成日:2026-10-31 21:49:28 UTC
# 技術:Node.js
### Node.js ###
logs
# Node.js 診断レポート
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# プロセスIDファイル
pids
# プロセスIDファイル
*.pid
# ランダムシードファイル
*.seed
# プロセスロックファイル
*.pid.lock
# Lernaのデバッグログ
lerna-debug.log*
# ライブラリのカバレッジ
lib-cov
# ログファイル
*.log
# カバレッジデータ用ディレクトリ
coverage
# LCOV カバレッジ データ
*.lcov
# TypeScript のビルド情報
*.tsbuildinfo
# NYC カバレッジの出力
.nyc_output
# npmデバッグログ
npm-debug.log*
# Grunt中間ストレージ
.grunt
# Yarnのデバッグログ
yarn-debug.log*
# Bower の依存関係
bower_components
# Yarn のエラーログ
yarn-error.log*
# node-waf の設定
.lock-wscript
# コンパイルされたバイナリ アドオン
build/Release
# Node.jsの依存関係
node_modules/
# JSPM パッケージ
jspm_packages/
# Snowpack のモジュール
web_modules/
# npmキャッシュディレクトリ
.npm
# ESLint キャッシュ
.eslintcache
# Stylelint キャッシュ
.stylelintcache
.node_repl_history
*.tgz
.yarn-integrity
# 環境変数
.env
.env.*
!.env.example
# キャッシュディレクトリ
.cache
# Parcel バンドラーのキャッシュ
.parcel-cache
# Next.js ビルドの出力
.next
# Next.js 静的エクスポート
out
# Nuxt.js ビルド出力
.nuxt
dist
.cache/
# Nitro/Nuxt 本番ビルドの出力
.output
# VuePress ビルド出力
.vuepress/dist
# 一時ファイル
.temp
.svelte-kit/
**/.vitepress/dist
**/.vitepress/cache
# Docusaurus のキャッシュ
.docusaurus
# サーバーレスフレームワーク
.serverless/
# FuseBox キャッシュ
.fusebox/
# ローカル DynamoDB
.dynamodb/
.firebase/
# Tern.js ポート ファイル
.tern-port
# VS Codeのテストディレクトリ
.vscode-test
.pnpm-store
# Yarn Plug'n'Play
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vite/
Node.js のルールで除外されるもの
以下の各パターンと、.gitignore に含める理由を説明します。
ログ
| パターン |
除外対象 |
logs |
ログ |
lerna-debug.log* |
Lernaのデバッグログ |
*.log |
ログファイル |
npm-debug.log* |
npmデバッグログ |
yarn-debug.log* |
Yarnのデバッグログ |
yarn-error.log* |
Yarn のエラーログ |
診断レポート (https://nodejs.org/api/report.html)
| パターン |
除外対象 |
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json |
Node.js 診断レポート |
ランタイムデータ
| パターン |
除外対象 |
pids |
プロセスIDファイル |
*.pid |
プロセスIDファイル |
*.seed |
ランダムシードファイル |
*.pid.lock |
プロセスロックファイル |
jscoverage/JSCover によって生成されたインストルメント化されたライブラリのディレクトリ
| パターン |
除外対象 |
lib-cov |
ライブラリのカバレッジ |
istanbul などのツールで使用されるカバレッジ ディレクトリ
| パターン |
除外対象 |
coverage |
カバレッジデータ用ディレクトリ |
*.lcov |
LCOV カバレッジ データ |
.nyc_output |
NYC カバレッジの出力 |
TypeScript キャッシュ
| パターン |
除外対象 |
*.tsbuildinfo |
TypeScript のビルド情報 |
Grunt 中間ストレージ (https://gruntjs.com/creating-plugins#storing-task-files)
| パターン |
除外対象 |
.grunt |
Grunt中間ストレージ |
Bower 依存関係ディレクトリ (https://bower.io/)
| パターン |
除外対象 |
bower_components |
Bower の依存関係 |
.lock-wscript |
node-waf の設定 |
コンパイルされたバイナリ アドオン (https://nodejs.org/api/addons.html)
| パターン |
除外対象 |
build/Release |
コンパイルされたバイナリ アドオン |
依存関係ディレクトリ
| パターン |
除外対象 |
node_modules/ |
Node.jsの依存関係 |
jspm_packages/ |
JSPM パッケージ |
Snowpack 依存関係ディレクトリ (https://snowpack.dev/)
| パターン |
除外対象 |
web_modules/ |
Snowpack のモジュール |
オプションの npm キャッシュ ディレクトリ
| パターン |
除外対象 |
.npm |
npmキャッシュディレクトリ |
オプションのeslintキャッシュ
| パターン |
除外対象 |
.eslintcache |
ESLint キャッシュ |
オプションの stylelint キャッシュ
| パターン |
除外対象 |
.stylelintcache |
Stylelint キャッシュ |
オプションの REPL 履歴
| パターン |
除外対象 |
.node_repl_history |
オプションの REPL 履歴 |
'npm pack' の出力
| パターン |
除外対象 |
*.tgz |
'npm pack' の出力 |
Yarn の整合性ファイル
| パターン |
除外対象 |
.yarn-integrity |
Yarn の整合性ファイル |
.env |
環境変数 |
.env.* |
Yarn の整合性ファイル |
!.env.example |
Yarn の整合性ファイル |
.cache |
キャッシュディレクトリ |
.parcel-cache |
Parcel バンドラーのキャッシュ |
Next.js ビルドの出力
| パターン |
除外対象 |
.next |
Next.js ビルドの出力 |
out |
Next.js 静的エクスポート |
Nuxt.js のビルド/出力の生成
| パターン |
除外対象 |
.nuxt |
Nuxt.js ビルド出力 |
dist |
Nuxt.js のビルド/出力の生成 |
.output |
Nitro/Nuxt 本番ビルドの出力 |
Gatsby 関連ファイル
| パターン |
除外対象 |
.cache/ |
Gatsby 関連ファイル |
.vuepress/dist |
VuePress ビルド出力 |
.temp |
一時ファイル |
Sveltekit キャッシュ ディレクトリ
| パターン |
除外対象 |
.svelte-kit/ |
Sveltekit キャッシュ ディレクトリ |
**/.vitepress/dist |
vitepress ビルド出力 |
**/.vitepress/cache |
vitepress キャッシュ ディレクトリ |
Docusaurus のキャッシュと生成されたファイル
| パターン |
除外対象 |
.docusaurus |
Docusaurus のキャッシュ |
サーバーレスディレクトリ
| パターン |
除外対象 |
.serverless/ |
サーバーレスフレームワーク |
FuseBox キャッシュ
| パターン |
除外対象 |
.fusebox/ |
FuseBox キャッシュ |
DynamoDB ローカル ファイル
| パターン |
除外対象 |
.dynamodb/ |
ローカル DynamoDB |
Firebaseのキャッシュディレクトリ
| パターン |
除外対象 |
.firebase/ |
Firebaseのキャッシュディレクトリ |
TernJSポートファイル
| パターン |
除外対象 |
.tern-port |
Tern.js ポート ファイル |
Visual Studio Code 拡張機能のテストに使用される Visual Studio Code バージョンを保存します
| パターン |
除外対象 |
.vscode-test |
VS Codeのテストディレクトリ |
.pnpm-store |
pnpm |
.pnp.* |
Yarn Plug'n'Play |
.yarn/* |
Visual Studio Code 拡張機能のテストに使用される Visual Studio Code バージョンを保存します |
!.yarn/patches |
Visual Studio Code 拡張機能のテストに使用される Visual Studio Code バージョンを保存します |
!.yarn/plugins |
Visual Studio Code 拡張機能のテストに使用される Visual Studio Code バージョンを保存します |
!.yarn/releases |
Visual Studio Code 拡張機能のテストに使用される Visual Studio Code バージョンを保存します |
!.yarn/sdks |
Visual Studio Code 拡張機能のテストに使用される Visual Studio Code バージョンを保存します |
!.yarn/versions |
Visual Studio Code 拡張機能のテストに使用される Visual Studio Code バージョンを保存します |
Vite ファイル
| パターン |
除外対象 |
vite.config.js.timestamp-* |
Vite ファイル |
vite.config.ts.timestamp-* |
Vite ファイル |
.vite/ |
Vite ファイル |
この Node.js 用 .gitignore の使い方
- 上の Node.js 用ルールをコピーするか、ファイルを直接ダウンロードしてください。
- Git リポジトリのルートに .gitignore という名前のファイルを作り、ルールを貼り付けます。
- 対象のファイルがすでに追跡されている場合は、git rm -r --cached . を実行して再度コミットしてください。Git の除外ルールは未追跡のファイルにのみ適用されます。
- チーム全員で同じルールを共有できるよう、.gitignore をコミットします。