How to compile and run an ES6 file with node when using babel6?

760

Solution 1

The message could be clearer. You've installed the babel package and you should have installed the babel-cli package.

npm uninstall babel
npm install babel-cli

Solution 2

Upon installing babel-cli I also had to specify the es2015 loader and to specifically use my local babel-node package since I don't have it installed globally.

./node_modules/.bin/babel-node --presets es2015 server.js
Share:
760

Related videos on Youtube

Nelu
Author by

Nelu

Updated on November 29, 2022

Comments

  • Nelu
    Nelu over 1 year

    I installed the latest version 6 of babel, babel-core and babel-loader.

    How can I run an ES6 file in Node with Babel6?

    Previously I would run the command

    babel-node server.js
    

    but now I get this message:

    The CLI has been moved into the package `babel-cli`. See http://babeljs.io/docs/usage/cli/.
    

    None of the instructions on that page say how to do this.

  • NewUser
    NewUser over 12 years
    not really sure how to use the diskpart.exe.. i'm trying to figure out also, as i have two harddisk and one thumbdrive already become raw file system.
  • afrazier
    afrazier over 12 years
    list disk will show you a list of drives. You should be able to identify the HD you want to install on by its capacity. If not, disconnect your data drives until you're done with the installation. select disk n will select the drive (where n is the matching disk number from the output of list disk). clean will erase the 1st MB, which contains the boot sector & partition table. From there you can exit and go into the regular Windows setup to repartition the drive as a blank, new drive.