What should I do with Grunt's node_modules directory when I am publisihing my project to GitHub?
git, gruntjs
Solution
The reason you should not install grunt and grunt plugins globally is because then you could only have 1 version of each installed at a time. While working with a team, it also means every single member of your team must be running the same version of grunt and each grunt plugin.
Coordinating these versions with a team and switching versions as you jump to different projects is a nightmare. The solution, install everything locally. It's just file space and most modules don't take a whole lot of space.
Most people don't commit their `node_modules` folder into github. Each dependency listed in your `package.json` can be installed again by typing: `npm install` in the same folder.
Use `npm install grunt --save-dev` to save to your `package.json` as you install plugins and modules.
The only sensible reason to commit `node_modules`, IMO, is with a private application and repo intended to be deployed to production. Where you want to be sure your dependencies are locked down and not breaking something upon push. There are still other strategies to avoid committing `node_modules`, even with this use case though (such as npm shrinkwrap).
In short:
- If you're deploying an app and paranoid about locking down your deps, commit your node_modules.
- Everything else, dont commit your node_modules.
Problem
This is my first project using Grunt and Git. In my project I have '*node_modules*' directory that I created by command 'npm install grunt'. Now I want to publish my project to GitHub. Should my project contains 'node_modules' or I should omit it? I am afraid that it makes the project scary for a developers who are unfamiliar with Grunt. In fact I am puzzled why you should install grunt for each project separately. Why it is not possible to install it globally? Here is my installation: grunt-contrib-concat, grunt-contrib-jshint, grunt-contrib-qunit, grunt-contrib-uglify, grunt-contrib-watch.