I installed Babel CLI (version 6) using npm install --global babel-cli
. I then install react preset using npm install --global babel-preset-react
.
You can specify the absolute (or relative) path to the preset you are trying to use, e.g:
babel --presets /usr/local/lib/node_modules/babel-preset-react --watch jsx/ --out-dir js/
You can do it this way. Write these lines in your prompt. Now the only thing is with global you might have to use the fix suggested above by @Petar which is
babel --presets /usr/local/lib/node_modules/babel-preset-react --watch jsx/ --out-dir js/
but this one does all you need.
npm i babel-cli babel-preset-react
babel --presets react jsx/ --watch --out-dir js/
and Then optionally add a .gitignore file in your github repo with content = node_modules/ now run your jsx transformation with the same command.