keras-js icon indicating copy to clipboard operation
keras-js copied to clipboard

Unexpected identifier async _initialize()

Open napindc opened this issue 7 years ago • 5 comments

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)

napindc avatar Jan 28 '18 15:01 napindc

I have the same issue here. Any workarounds?

fredmarques avatar Jan 29 '18 21:01 fredmarques

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

dmeffert avatar Feb 09 '18 07:02 dmeffert

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 avatar Mar 11 '18 06:03 kimamula

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?

kimamula avatar Mar 11 '18 06:03 kimamula

Run this npm uninstall ember-cli npm cache clean && bower cache clean npm install [email protected]

mahirabidi avatar May 16 '19 09:05 mahirabidi