ava-ia / core

Agnostic Virtual Assistant
219 stars 21 forks source link

"ReferenceError: regeneratorRuntime is not defined" with readme example #12

Open deleteman opened 8 years ago

deleteman commented 8 years ago

Hey I'm trying out the example from the readme file, but I'm getting an error.

Here's the code for the example:

'use strict'

var Ava = require("ava-ia").Ava;

var weather = require('ava-ia/lib/intents').weather;
var movie = require('ava-ia/lib/intents').movie;

var forecastYahoo = require("ava-ia/lib/actions").forecastYahoo;
var forecastMSN = require("ava-ia/lib/actions").forecastMSN;
var movieDB = require("ava-ia/lib/actions").movieDB;

// 1. New instance
const ava = new Ava({
  debug: true // If you want see intents/actions trace log.
});

// 2. Configure the intents
ava
  .intent(weather, [forecastYahoo, forecastMSN])
  .intent(movie, movieDB);

// 3. Chat with Ava
ava.listen('Do you know if tomorrow will rain in Bangkok?')
  .then(state => console.log(state))
  .catch(error => console.log(state))

And here's the error I'm getting:

/home/fernandodoglio/workspace/personal/ava/node_modules/ava-ia/lib/helpers/factoryActions.js:10 var ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(state, actions) { ^

ReferenceError: regeneratorRuntime is not defined at /home/fernandodoglio/workspace/personal/ava/node_modules/ava-ia/lib/helpers/factoryActions.js:10:31 at Object. (/home/fernandodoglio/workspace/personal/ava/node_modules/ava-ia/lib/helpers/factoryActions.js:36:2) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (/home/fernandodoglio/workspace/personal/ava/node_modules/ava-ia/lib/helpers/index.js:43:23) at Module._compile (module.js:409:26)

mjeries commented 7 years ago

The example seems to be using babel-polyfill and babel-register. If you do not have those, try installing and requiring them at the top of the file.