Node.js · Junior · Question 29 of 75
Should node_modules be committed to git?
- ✓Correct answer: No: add it to
.gitignoreand commitpackage.jsonwith the lock file instead - 2Only the folders of packages you wrote yourself
- 3Yes, always, so the project works offline
Explanation
node_modules is large and platform-specific (native modules). Anyone can recreate it exactly from the lock file with npm ci.