gitignore for node modules code example
Example 1: Node.JS gitignore
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
pids
*.pid
*.seed
*.pid.lock
lib-cov
coverage
*.lcov
.nyc_output
.grunt
bower_components
.lock-wscript
build/Release
node_modules/
jspm_packages/
web_modules/
*.tsbuildinfo
.npm
.eslintcache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
.node_repl_history
*.tgz
.yarn-integrity
.env
.env.test
.cache
.parcel-cache
.next
out
.nuxt
dist
.cache/
.vuepress/dist
.serverless/
.fusebox/
.dynamodb/
.tern-port
.vscode-test
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
Example 2: how to gitignore node modules
touch .gitignore //to create a .gitignore if you dont have one
echo "node_modules/" >> .gitignore //this adds node_modules to gitignore
cat .gitignore //checks what files you have in your gitignore
Example 3: ignore node modules
//create a .gitignore file and add the following in it
node_modules
Example 4: git ignore node_modules
If you add the below text into your .gitignore file,
then it will look for the node_modules directory. Then the node_modules
directory will be ignored.
node_modules/