0

I'm having trouble running the Emporium Web app - here's what I've tried:

SyntaxError: Unexpected reserved word

enter image description here

Please note this is a different issue that cannot be resolved by following the answers in unexpected reserved word import in node.js.

How can I run this Emporium web app?

Community
  • 1
  • 1
Ryan
  • 6,027
  • 16
  • 52
  • 89

2 Answers2

0

In the root create:

.babelrc

...and paste this:

{
  "presets": ["es2015"]
}

In the root create:

babel.js

... and paste this:

require("babel-register")({    
    ignore: function(filename) {
        if (filename === "app.js") {
            return false;
        } else {
            return true;
        }
    }
});

node babel.js

node app.js

Ryan
  • 6,027
  • 16
  • 52
  • 89
0

IMHO it is possible to follow the answers mentioned in the link given in the question and get it working. It does talks about transpiling which is the way to go, albeit with a few changes , given the link is almost 2 years old.

We just have to do a

npm install -g babel-core

or a local install if not feeling global .And change the start script to include the presets.

"start": "nodemon ./app.js --exec babel-node --presets es2015"

semuzaboi
  • 4,972
  • 5
  • 20
  • 35