.gitignore for Node.js

61 ignore rules for Node.js, ready to copy into your repository.

JavaScript runtime built on Chrome's V8 engine

The complete .gitignore for Node.js

# Generated by LFGitignore - https://lfgitignore.com
# Created: 2025-08-15 17:22:18 UTC
# Technologies: Node.js

### Node.js ###
logs
# Node.js diagnostic reports
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Process ID files
pids
# Process ID file
*.pid
# Random seed file
*.seed
# Process lock file
*.pid.lock
# Lerna debug logs
lerna-debug.log*
# Library coverage
lib-cov
# Log file
*.log
# Coverage directory
coverage
# LCOV coverage data
*.lcov
# TypeScript build info
*.tsbuildinfo
# NYC coverage output
.nyc_output
# npm debug logs
npm-debug.log*
# Grunt intermediate storage
.grunt
# Yarn debug logs
yarn-debug.log*
# Bower dependencies
bower_components
# Yarn error logs
yarn-error.log*
# node-waf configuration
.lock-wscript
# Compiled binary addons
build/Release
# Node.js dependencies
node_modules/
# JSPM packages
jspm_packages/
# Snowpack modules
web_modules/
# npm cache directory
.npm
# ESLint cache
.eslintcache
# Stylelint cache
.stylelintcache
.node_repl_history
*.tgz
.yarn-integrity
# Environment variables
.env
.env.*
!.env.example
# Cache directory
.cache
# Parcel bundler cache
.parcel-cache
# Next.js build output
.next
# Next.js static export
out
# Nuxt.js build output
.nuxt
dist
.cache/
# VuePress build output
.vuepress/dist
# Temporary files
.temp
.svelte-kit/
**/.vitepress/dist
**/.vitepress/cache
# Docusaurus cache
.docusaurus
# Serverless framework
.serverless/
# FuseBox cache
.fusebox/
# Local DynamoDB
.dynamodb/
.firebase/
# Tern.js port file
.tern-port
# VS Code test directory
.vscode-test
# Yarn Plug'n'Play
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

What these Node.js rules actually ignore

Every pattern below, and why it belongs in your .gitignore.

Logs

Pattern What it ignores
logs Logs
lerna-debug.log* Lerna debug logs
*.log Log file
npm-debug.log* npm debug logs
yarn-debug.log* Yarn debug logs
yarn-error.log* Yarn error logs

Diagnostic reports (https://nodejs.org/api/report.html)

Pattern What it ignores
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json Node.js diagnostic reports

Runtime data

Pattern What it ignores
pids Process ID files
*.pid Process ID file
*.seed Random seed file
*.pid.lock Process lock file

Directory for instrumented libs generated by jscoverage/JSCover

Pattern What it ignores
lib-cov Library coverage

Coverage directory used by tools like istanbul

Pattern What it ignores
coverage Coverage directory
*.lcov LCOV coverage data
.nyc_output NYC coverage output

TypeScript cache

Pattern What it ignores
*.tsbuildinfo TypeScript build info

Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

Pattern What it ignores
.grunt Grunt intermediate storage

Bower dependency directory (https://bower.io/)

Pattern What it ignores
bower_components Bower dependencies
.lock-wscript node-waf configuration

Compiled binary addons (https://nodejs.org/api/addons.html)

Pattern What it ignores
build/Release Compiled binary addons

Dependency directories

Pattern What it ignores
node_modules/ Node.js dependencies
jspm_packages/ JSPM packages

Snowpack dependency directory (https://snowpack.dev/)

Pattern What it ignores
web_modules/ Snowpack modules

Optional npm cache directory

Pattern What it ignores
.npm npm cache directory

Optional eslint cache

Pattern What it ignores
.eslintcache ESLint cache

Optional stylelint cache

Pattern What it ignores
.stylelintcache Stylelint cache

Optional REPL history

Pattern What it ignores
.node_repl_history Optional REPL history

Output of 'npm pack'

Pattern What it ignores
*.tgz Output of 'npm pack'

Yarn Integrity file

Pattern What it ignores
.yarn-integrity Yarn Integrity file
.env Environment variables
.env.* Yarn Integrity file
!.env.example Yarn Integrity file
.cache Cache directory
.parcel-cache Parcel bundler cache

Next.js build output

Pattern What it ignores
.next Next.js build output
out Next.js static export

Nuxt.js build / generate output

Pattern What it ignores
.nuxt Nuxt.js build output
dist Nuxt.js build / generate output

Gatsby files

Pattern What it ignores
.cache/ Gatsby files
.vuepress/dist VuePress build output
.temp Temporary files
.cache Cache directory

Sveltekit cache directory

Pattern What it ignores
.svelte-kit/ Sveltekit cache directory
**/.vitepress/dist vitepress build output
**/.vitepress/cache vitepress cache directory

Docusaurus cache and generated files

Pattern What it ignores
.docusaurus Docusaurus cache

Serverless directories

Pattern What it ignores
.serverless/ Serverless framework

FuseBox cache

Pattern What it ignores
.fusebox/ FuseBox cache

DynamoDB Local files

Pattern What it ignores
.dynamodb/ Local DynamoDB

Firebase cache directory

Pattern What it ignores
.firebase/ Firebase cache directory

TernJS port file

Pattern What it ignores
.tern-port Tern.js port file

Stores VSCode versions used for testing VSCode extensions

Pattern What it ignores
.vscode-test VS Code test directory
.pnp.* Yarn Plug'n'Play
.yarn/* Stores VSCode versions used for testing VSCode extensions
!.yarn/patches Stores VSCode versions used for testing VSCode extensions
!.yarn/plugins Stores VSCode versions used for testing VSCode extensions
!.yarn/releases Stores VSCode versions used for testing VSCode extensions
!.yarn/sdks Stores VSCode versions used for testing VSCode extensions
!.yarn/versions Stores VSCode versions used for testing VSCode extensions

Vite logs files

Pattern What it ignores
vite.config.js.timestamp-* Vite logs files
vite.config.ts.timestamp-* Vite logs files

How to use this .gitignore for Node.js

  1. Copy the Node.js rules above, or download the file directly.
  2. Create a file named .gitignore at the root of your Git repository and paste the rules into it.
  3. If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
  4. Commit the .gitignore so everyone on the team shares the same rules.