transcranial / keras-js

Run Keras models in the browser, with GPU support using WebGL
https://transcranial.github.io/keras-js
MIT License
4.96k stars 501 forks source link

Unexpected identifier async _initialize() #103

Open napindc opened 6 years ago

napindc commented 6 years ago

I'm getting the below error when using this package. Is there anyway to fix this?

I'm using node 8.9.3. And it has worked locally... and had worked when I deployed it to Google's Firebase functions, but all of a sudden today I'm trying to deploy to firebase functions again, and I get this error. I hadn't run any npm install / update so not sure why this happened today.

Detailed stack trace: /user_code/node_modules/keras-js/lib/Model.js:107
  async _initialize() {
        ^^^^^^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/user_code/node_modules/keras-js/lib/index.js:22:37)
fredmarques commented 6 years ago

I have the same issue here. Any workarounds?

dmeffert commented 6 years ago

Suddenly started happening here as well. Did one of you manage to find away around this?

kimamula commented 6 years ago

The runtime of Google Cloud Functions is Node v6.11.5, which does not support async/await.

https://cloud.google.com/functions/docs/writing/#the_cloud_functions_runtime

A possible workaround is using babel-register to transpile async/await on runtime, though I think keras-js should not use async/await (or at least should transpile them before releasing) until Node.js v6.x comes to the end of life (April 2019).

kimamula commented 6 years ago

I found that keras-js does not even support the latest LTS (Node v8.x).

https://github.com/transcranial/keras-js/blob/df999159284abc5de0b92bc0f801375c08bf9008/.babelrc.js#L4

Is there any reason for that?

mahirabidi commented 5 years ago

Run this npm uninstall ember-cli npm cache clean && bower cache clean npm install ember-cli@3.3.0