I\'m adapting a library that uses callback to use Promises. It\'s working when I use then()
, but it doesn\'t work when I use await
.
You don't read that error message right: the problem isn't the function you're calling but the function you're in.
You may do
(async function(){
await dbc.solve(img);
// more code here or the await is useless
})();
Note that this trick should soon enough not be needed anymore in node's REPL: https://github.com/nodejs/node/issues/13209