I was working on a JS file at work where I had babel installed, running babel file.js | node
I sent the file home to work in the evening, installed babel at home and I got the following error when I run the above command:
The CLI has been moved into the package 'babel-cli'
Any ideas? Thank you in advance :)
If I install the CLI - the following code fails to compile:
function sumArrayIndex(array, i, separator) {
return array
.map(x => x.split(separator)
.map(c => { return parseInt(c) })
)
.map(x => { return x[i]; })
.reduce((x, y) => { return x += y }, 0);
}
function minToSec(m) {
return m * 60
}
function secondsToMinutesAndSeconds(s) {
var min = s / 60;
var sec = s % 60;
minutes += Math.floor(min);
seconds += sec;
}
function outputTime() {
return hours + ':' + minutes + ':' + seconds;
}
答案 0 :(得分:10)
Babel version 6 split the project into several modules. As the message indicates the CLI has moved to babel-cli
.
I suggest you use the same version that you use at work (which is probably v5):
npm install -g babel@5
However, if you would rather use the latest version:
npm install -g babel-cli