I'm building a grunt javascript project with grunt, and I have a package.json file that looks something like:
{
... name, author, etc here ...
"dependencies": {
"grunt-html":"0.2.1"
}
}
I can run npm install
to install grunt-html and this works just fine. But when I add new dependencies, all developers on the team must know to run npm install
again. Is there a way to automatically install any packages that have not yet been installed? Should I just run npm install always to ensure I'm up to date?
Yes npm install
is the easiest way IMO. Getting everyone familiar with the other npm
commands makes managing deps easier as well. Such as:
npm ls
to list out the currently installed modules.--save
flag ie, npm install grunt-html --save
to install and insert the package and version into your package.json
.npm prune
to remove modules not included in your package.json
.Other ways to manage dependencies are to commit the node_modules
folder in your repository to avoid other devs from having to run npm install
. Or for more complex projects consider using npm shrinkwrap
to lock down dependencies to specific versions: npm shrinkwrap docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With