We use direnv
and nvm
to automatically load the correct version of Node, NPM and Serverless Framework into the shell.
Use the install script for Node Version Manager then run the following command in your terminal
npm install -g avn avn-nvm && avn setup
OSX users can install direnv using Homebrew
brew install direnv
Add the following line to your .bash_profile
eval "$(direnv hook bash)"
or if you use zsh enter this to your .zshrc
eval "$(direnv hook zsh)"
Once the above are installed, navigate to the project root and the following to install npm modules (including serverless) and run the environment loader
npm install && direnv allow .
You need to create a .env-deploy
file to deploy the project to your environment
AWS_PROFILE=your_dev_profile
AWS_REGION=us-east-1
SERVICE_ENV=dev
If you want to load more environment variables create more .env-xx
files to load variables.