abbr / deasync

Turns async function into sync via JavaScript wrapper of Node event loop
MIT License
971 stars 73 forks source link

node 16.x support #146

Closed fwininger closed 3 years ago

fwininger commented 3 years ago

Can you add the support of 16.X deasync\bin, at least for Linux x86_64 ?

Thanks :)

kazuma1989 commented 3 years ago

Just information. This example in the README did not work.

var deasync = require('deasync');
var cp = require('child_process');
var exec = deasync(cp.exec);
// output result of ls -la
try{
    console.log(exec('ls -la'));
}
catch(err){
    console.log(err);
}
// done is printed last, as supposed, with cp.exec wrapped in deasync; first without.
console.log('done');

Results

$ node -v
v16.2.0
$ node deasync-example.js 
/Users/kazuma/work/2020/react-redux-web/node_modules/bindings/bindings.js:135
  throw err;
  ^

Error: Could not locate the bindings file. Tried:
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/Debug/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/Release/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/out/Debug/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/Debug/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/out/Release/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/Release/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/default/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/compiled/16.2.0/darwin/x64/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/addon-build/release/install-root/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/addon-build/debug/install-root/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/addon-build/default/install-root/deasync.node
 → /Users/kazuma/work/2020/react-redux-web/node_modules/deasync/lib/binding/node-v93-darwin-x64/deasync.node
    at bindings (/Users/kazuma/work/2020/react-redux-web/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/index.js:30:31)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/Users/kazuma/work/2020/react-redux-web/deasync-example.js:1:15)
    at Module._compile (node:internal/modules/cjs/loader:1109:14) {
  tries: [
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/Debug/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/Release/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/out/Debug/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/Debug/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/out/Release/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/Release/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/build/default/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/compiled/16.2.0/darwin/x64/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/addon-build/release/install-root/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/addon-build/debug/install-root/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/addon-build/default/install-root/deasync.node',
    '/Users/kazuma/work/2020/react-redux-web/node_modules/deasync/lib/binding/node-v93-darwin-x64/deasync.node'
  ]
}
abbr commented 3 years ago

fixed with v0.1.22

fwininger commented 3 years ago

@abbr thank you !