Npm install trick
When you install a package with npm it can be a real pain in the ass to update the package.json file. So you want to use the --save flag.
npm install sax --save
In this example, the save flag will automatically append sax in your dependencies inside your package.json file and it even gets the correct version number for you.
Written by Eric Raio
Related protips
8 Responses
Note there's also --save-dev and --save-opt to save into development and optional dependencies respectively.
that awesome... I really needed something like that
Or use the shorthand, -S
Or -D... etc
+1
As an npm noob, I have this nagging question. Do both rvm install 'packagename' -g
and npm install 'packagename' -g
work the same/similarly? I'm referring to the -g or global flag.
Then, if not global, does one have "cd" to the correct app folder, then "npm install" in much the same way one would obviously "git init" in that folder? I assume yes, just making sure.
Yep the -g installs globally, you can run it from where you like
owesome tip.