I installed Babel globally like this:
npm install -g babel-cli
npm install -g babel-preset-latest
I know it's not recommended to do it globally, but I prefer this way to keep my directory clean (no node_modules/ and no package.json)
Then I have a mainES6.js file written in ES6 that I want in ES5, so I do this:
babel mainES6.js -o mainES5.js --presets latest
And I get this message: Error: Couldn't find preset "latest" relative to directory "/path/to/my/file/"
How to make that work?
This already has been mentioned in Babel GitHub Issues: babel-cli and babel-node ignore global presets (installed with npm -g). It seems that there's no way to make it work apart from installing it locally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With