Quick tip: Adding NPM dependencies

Just a quick tip. If you’re learning node you don’t usually see this on the tutorials, so you might not know it. When you install a new NPM dependency for your project, like this

$ npm install module

Then you also need to manually add it to package.json, so that anyone else can run npm install and run your code. You need to manually figure out which version(s) your project depends on. Instead try

$ npm install module --save 

Which adds the dependency to package.json automatically. Nice.