Skip to content

Instantly share code, notes, and snippets.

@jhurliman
Last active January 26, 2016 00:23
Show Gist options
  • Save jhurliman/cb14aa760b2a504b3d97 to your computer and use it in GitHub Desktop.
Save jhurliman/cb14aa760b2a504b3d97 to your computer and use it in GitHub Desktop.
ES6/ES7 setup for sandbox development of modern code

These instructions will allow you to write and run one-off node.js scripts using modern ECMAScript syntax, including async/await.

  1. Install Babel globally

npm install -g babel-cli

  1. Add a .babelrc file to the folder holding your code containing the following:

{ "presets": [ "es2015", "stage-3" ] }

  1. Run your ES6/ES7 script with babel-node {script}.js

Alternatively, you can skip the .babelrc file creation and just run babel-node --presets es2015,stage-3 {script}.js

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