Npm error installing babel

  node.js, question

The following error was output when babel was installed through npm

zhouruibin@Litter-bear:~/Desktop$ sudo npm install -g babel
 /usr/local/bin/babel -> /usr/local/lib/node_modules/babel/cli.js
 /usr/local/bin/babel-node -> /usr/local/lib/node_modules/babel/cli.js
 /usr/local/bin/babel-external-helpers -> /usr/local/lib/node_modules/babel/cli.js
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires once@'~1.1.1' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/once,
 npm WARN unmet dependency which is version 1.3.2
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires mkdirp@'~0.3.3' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/mkdirp,
 npm WARN unmet dependency which is version 0.5.1
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires osenv@'0.0.3' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/osenv,
 npm WARN unmet dependency which is version 0.1.3
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires nopt@'2' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/nopt,
 npm WARN unmet dependency which is version 3.0.4
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires semver@'2' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/semver,
 npm WARN unmet dependency which is version 5.0.3
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npmconf requires ini@'~1.1.0' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/ini,
 npm WARN unmet dependency which is version 1.3.4
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data requires semver@'2' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/semver,
 npm WARN unmet dependency which is version 5.0.3
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data requires github-url-from-git@'~1.1.1' but will load
 npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/github-url-from-git,
 npm WARN unmet dependency which is version 1.4.0
 babel@6.0.12 /usr/local/lib/node_modules/babel
zhouruibin@Litter-bear:~/Desktop$ babel
 /usr/local/bin/babel: line 3: syntax error near unexpected token `"The CLI has been moved into the package `babel-cli`."'
 /usr/local/bin/babel: line 3: `console.error("The CLI has been moved into the package `babel-cli`.");  '

From the steps in this articleHttp://www.codefrom.com/paper/Babel.js% E6% 8F% 92% E4% BB% B6% E5% BC% 80% E5% 8F% 91% E4% B9% 8B% E4% B8% 80% 20- 20Babel% E4% B8% 8EAST

I also used the official websitehttps://babeljs.io/docs/usage/cli/Inside’s steps, using npm install –global babel-cli, can work on the command line inside babel command, but I didn’t convert ES6 into ES5 at all, just the original output, I used babel to provide online conversionhttp://babeljs.io/replBy contrast, it is totally inconsistent! ! !

Who can tell me the problem is what’s up ? ?

The code for the test transformation is as follows (ES6):

//definition of class
 class Animal {
 //New Constructor in ES 6
 constructor(name) {
 this.name = name;
 bracket
 //instance method
 sayName() {
 Log ('mynameis' plus this.name);
 bracket
 bracket
 //class inheritance
 class Programmer extends Animal {
 constructor(name) {
 //Directly call the parent class constructor to initialize
 super(name);
 bracket
 program() {
 console.log("I'm coding...");
 bracket
 bracket
 //Test our class
 var animal=new Animal('dummy'),
 wayou=new Programmer('wayou');
 animal.sayName();  //output 'myname isdummy'
 wayou.sayName();  //output 'myname iswayou'
 wayou.program();  //output 'i'm coding ...'

The new version of babel is split into babel-cli and babel-core. You have to install both.