How many times have you had this conversation?
"Hey, the project doesn't run on my machine any more."
"Have you tried running
npm install
?"
...pause...
"Yeah, that fixed it, thanks"
This is a neat trick that shows a warning in the console when starting up a project if the dependencies are out of date.
It does this by comparing the modified time of package.json
with the modified time of node_modules
. However that on its own isn't enough because running npm install
doesn't necessarily update the file modified time of the folder. Adding a simple touch node_modules
command as a postinstall
task to package.json
fixes this.
Add the check-deps
task as a dependency of your default gulp task so it always runs when starting up a project. Depending how idiot proof you wanna get, you could even add it as a post-update hook to your git checkout.