In order to use Babel in our project we will need NodeJS and NPM installed. NPM is a Node Package Manager and we will be using it to install Babel.
Click here to read the tutorial on How to install NodeJS on Mac.
After installing Node and NPM you can check the version using the following command.
$ node -v
This will give the node version.
$ npm -v
This will give the npm version.
At the time of writing this tutorial I was using Node v8.11.1 and NPM v6.1.0 on macOS. You may have a different latest version and that is totally fine.
Create a new project and give it a name lets say babel-project.
$ mkdir babel-project
Now inside the project folder run the following command
npm init to create package.json file and fill the required details.
Note! If you want to go with default values then you can use
npm init -y command.
$ npm init This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults. See `npm help json` for definitive documentation on these fields and exactly what they do. Use `npm install
We are now ready to set up Babel in our project.
Thanks for reading. See you in the next tutorial.