Reputation: 55
I had installed babel-cli globally using npm. And I had a script.js file which contains the ES6 code. When I tried to compile that using $babel script.js -o out.js, it just copy all the contains of the script.js to out.js.
As far I concern, it should convert all the ES6 code to ES5.
Even if I run the script.js file without any content, it should show "use strict"; in my out.js. But it shows an empty file. Unable to figure out whats wrong?
Moreover I am unable to understand why "https://www.npmjs.com/package/babel-cli" says to install babel-cli globally where as "https://babeljs.io/docs/setup/#babel_cli" says to install that locally.
When I installed babel-cli locally and try to compile the script.js file it simply shows
'babel' is not recognized as an internal or external command, operable program or batch file.
Upvotes: 3
Views: 4982
Reputation: 2176
First Go to main directory or open new terminal
step 1: go to main directory
open terminal or (type cd so that you can directly switch in main directory)
step 2 : npm install -g babel-cli
now successfully install babel cli in your machine
Upvotes: 1
Reputation: 31
This should answer your question worked for me. https://github.com/babel/babel/issues/4066
or install babel-cli globally and try it works then.
Upvotes: 3