Skip to content

Instantly share code, notes, and snippets.

@booyaa
Last active December 15, 2015 09:09
Show Gist options
  • Select an option

  • Save booyaa/5235731 to your computer and use it in GitHub Desktop.

Select an option

Save booyaa/5235731 to your computer and use it in GitHub Desktop.
node.js gotchas and pro tips

####package.json

if you're getting deprecation warnings, check the date of the blog post you're copying code from. chances are you're referencing old module versions.

###when deploying code

if you find you're getting oddness when deploying code to your awesome paas (nodejitsu, heroku, etc). one of your modules is probably reacting to NODE_ENV specifically when it's absent or set to production.

the easiest way to reproduce the oddness is to run the code locally this way:

NODE_ENV=production node.js path/to/your/app.js

you'll often find there some agressive caching enabled in express.

###npm install -save module

a quick way to add dependencies to your module

###.npmignore

use this to add empty directories, you'll still need to have an exclusion mask in .gitignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment