Giter VIP home page Giter VIP logo

deasync's People

Contributors

abbr avatar abetomo avatar amazingfate avatar amilajack avatar cclauss avatar daxtens avatar ivandov avatar liupeng0518 avatar melikhov-dev avatar nicolashenry avatar shipujin avatar vkurchatkin avatar whitef0x0 avatar wojtekmaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deasync's Issues

Assertion failed : Abort Trap

Hi,

I am using deasync module in my jasmine test cases.
Actually in my beforeall method of jasmine, I have to synchronously call some async methods in the same order (one after another).
But since Javascript is a single threaded scripting lang, hence I have to block the call b/w 2 async methods using deasync method...deasync.runlooponce(); used inside a while loop.

Now the issue is that in Microsoft OS, this works fine, but in case of Mac OS, the script fails abruptly, with the below error message:

Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type == UV_NAMED_PIPE), function uv___stream_fd, file ../deps/uv/src/unix/stream.c, line 1545. Abort trap: 6

Can you please help me out in resolving this issue on Mac OS.

PS : Just for your info, I am also making use of fs - file read & write in a synchronous manner, but making REST API http calls in Async manner.
Also in fs fileread method I am converting string text in JSON format using JSON.parse(string text)

Let me know in case you require any further info.

Regards
Simran

Using deasync under Electron 0.36.7 on Windows

I am trying to utilise deasync under Electron. The package works perfectly fine under OSX and works fine under NodeJS on Windows, but when attempting to load the module under Electron on Windows, I get the following:

App threw an error when running { [Error: Could not locate the bindings file. Tried:
 → {REMOVED}app\node_modules\deasync\build\deasync.node
 → {REMOVED}app\node_modules\deasync\build\Debug\deasync.node
 → {REMOVED}app\node_modules\deasync\build\Release\deasync.node
 → {REMOVED}app\node_modules\deasync\out\Debug\deasync.node
 → {REMOVED}app\node_modules\deasync\Debug\deasync.node
 → {REMOVED}app\node_modules\deasync\out\Release\deasync.node
 → {REMOVED}app\node_modules\deasync\Release\deasync.node
 → {REMOVED}app\node_modules\deasync\build\default\deasync.node
 → {REMOVED}app\node_modules\deasync\compiled\5.1.1\win32\x64\deasync.node]
  tries:
   [ '{REMOVED}app\\node_modules\\deasync\\build\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\build\\Debug\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\build\\Release\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\out\\Debug\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\Debug\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\out\\Release\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\Release\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\build\\default\\deasync.node',
     '{REMOVED}app\\node_modules\\deasync\\compiled\\5.1.1\\win32\\x64\\deasync.node' ] }

And below is the error being logged to a dialog:

windows_10

global install failer (linux / windows )

Hi , trying to install deasync via npm got this error :

Build failed
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\iojs\\node.exe" "C:\\Program Files\\iojs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "deasync"
npm ERR! node v2.3.1
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node ./build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node ./build.js'.
npm ERR! This is most likely a problem with the deasync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls deasync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

I guess i have some envirement configuration missing here . any clue on that . thx.

Context issue

There seems to be a context issue whereby this is wrong. This applies where the function passed to deasync() is a method on a class.

This is where it came up for me:

var dbh = mySQL.createConnection(db);
var query = deasync(dbh.query);
var rows = query(sql, [ params ]);

The first call inside Connection.query() is this._implyConnect(); but this fails because this is not set to an instance of Connection.

I'm not sure of the best way to fix this. I'm hoping you have more ideas than I do. :-)

Doesn't work with net.createConnection on Windows

If I use deasync + net.createConnection, the following code doesn't work on Windows but works on Mac.
I tested in Node.js v5.1.0.
Does loopWhile not process io events on Windows?
Please help me solve this.
Thanks.

'use strict';

var net = require('net');
var port = 8000;
var host = 'localhost';

var server = net.createServer(function(c) {
  c.on('data', function(data) {
    console.log('data on server: ' + data);
    console.log('sending c');
    c.write('c');
  });
  c.on('end', function() {
    server.close()
  });
  c.write('a');
});
server.listen(port, host);

var done = false;
var client = net.createConnection(port, host)
client.on('data', function(data) {
  console.log('data on client: ' + data)
  if (data == 'a') {
    console.log('sending b')
    client.write('b');
    require('deasync').loopWhile(() => !done);
    console.log('done');
    client.end()
  } else if (data == 'c') {
    done = true;
  } else {
    console.log('unknown data:' + data)
  }
});

Output on Mac Yosemite

data on client: a
sending b
data on server: b
sending c
data on client: c
done

Output on Windows 8.1 64 bit

data on client: a
sending b
data on server: b
sending c

If I modify the program above not to use deasync, it works well.

'use strict'

var net = require('net');
var port = 8000;
var host = 'localhost';

var server = net.createServer(function(c) {
  c.on('data', function(data) {
    console.log('data on server: ' + data);
    console.log('sending c');
    c.write('c');
  });
  c.on('end', function() {
    server.close()
  });
  c.write('a');
});
server.listen(port, host);

var done = false;
var client = net.createConnection(port, host)
client.on('data', function(data) {
  console.log('data on client: ' + data)
  if (data == 'a') {
    console.log('sending b')
    client.write('b');
  } else if (data == 'c') {
    console.log('done');
    done = true;
    client.end()
  } else {
    console.log('unknown data:' + data)
  }
});

Output on Windows 8.1 64 bit

data on client: a
sending b
data on server: b
sending c
data on client: c
done

[Node 4.0][windows 10] installation error -> MSBUILD error MSB4132 tools version "2.0" is unrecognized

cwd:
C:\Users\---\Desktop\---

command:
λ npm i --save deasync async

out:

npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
/
> [email protected] install C:\Users\---\Desktop\---\node_modules\deasync
> node ./build.js

C:\Users\---\Desktop\---\node_modules\deasync {git}{hg}                                                                                                                                                                      
{lamb} if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )                                             
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.                                                                                                                           
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".                                                                                                                                 
gyp ERR! build error                                                                                                                                                                                                                  
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1                                                                                                                            
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)                                                                                                        
gyp ERR! stack     at emitTwo (events.js:87:13)                                                                                                                                                                                       
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)                                                                                                                                                                             
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)                                                                                                                                          
gyp ERR! System Windows_NT 10.0.10240                                                                                                                                                                                                 
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"                                                                             
gyp ERR! cwd C:\Users\---\Desktop\---\node_modules\deasync                                                                                                                                                                   
gyp ERR! node -v v4.0.0                                                                                                                                                                                                               
gyp ERR! node-gyp -v v3.0.1                                                                                                                                                                                                           
gyp ERR! not ok                                                                                                                                                                                                                       
Build failed                                                                                                                                                                                                                          
npm ERR! Windows_NT 10.0.10240                                                                                                                                                                                                        
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "--save" "deasync" "async"                                                                                    
npm ERR! node v4.0.0                                                                                                                                                                                                                  
npm ERR! npm  v2.14.2                                                                                                                                                                                                                 
npm ERR! code ELIFECYCLE                                                                                                                                                                                                              

npm ERR! [email protected] install: `node ./build.js`                                                                                                                                                                                     
npm ERR! Exit status 1                                                                                                                                                                                                                
npm ERR!                                                                                                                                                                                                                              
npm ERR! Failed at the [email protected] install script 'node ./build.js'.                                                                                                                                                                
npm ERR! This is most likely a problem with the deasync package,                                                                                                                                                                      
npm ERR! not with npm itself.                                                                                                                                                                                                         
npm ERR! Tell the author that this fails on your system:                                                                                                                                                                              
npm ERR!     node ./build.js                                                                                                                                                                                                          
npm ERR! You can get their info via:                                                                                                                                                                                                  
npm ERR!     npm owner ls deasync                                                                                                                                                                                                     
npm ERR! There is likely additional logging output above.                                                                                                                                                                             

npm ERR! Please include the following file with any support request:                                                                                                                                                                  
npm ERR!     C:\Users\---\Desktop\---\npm-debug.log              

Not working for me on Linux Debian

Sometimes it working, sometimes not.

This is the messaage I got:

  node: ../deps/uv/src/unix/async.c:136: uv__async_io: Assertion `n == sizeof(val)' failed.

SIGSEGV error

I'm getting process exits with SIGSEGV error on any usage of deasync (generic wrapper and runLoopOnce() style). Node is v0.12.0. 'segfault-handler' provides following stack trace:

PID 40231 received SIGSEGV for address: 0x0
0 segfault-handler.node 0x00000001017f590f _ZL16segfault_handleriP9__siginfoPv + 287
1 libsystem_platform.dylib 0x00007fff94ef0f1a _sigtramp + 26
2 ??? 0x0000000400000000 0x0 + 17179869184
3 node 0x000000010058fdf3 _ZN4node12TLSCallbacks6DoReadEP11uv_stream_slPK8uv_buf_t14uv_handle_type + 115
4 node 0x000000010065c02a uv__stream_io + 1266
5 node 0x000000010066312f uv__io_poll + 1581
6 node 0x000000010065592c uv_run + 249
7 node 0x0000000100549c92 _ZN4node5StartEiPPc + 342
8 node 0x0000000100001374 start + 52
9 ??? 0x000000000000000a 0x0 + 10

help with this code

I am trying to use your library. Can you tell me what is wrong with this bit of code?:

var deasync = require('deasync');
var exec = deasync(async);

try{
   var much = exec('one','two',log);
    console.log(much);
}
catch(err){
    console.error(err);
    throw err;
}

console.log('done');



function async(jom,joy,cb){
    setTimeout(function(){
        cb('done with async');
    },1500);
}

function log(val){
    //console.log(val);
    return 'mucho';
}

io.js support?

Io.JS: v1.6.4
NPM: v2.7.5

npm install deasync fails with

227 verbose rebuildBundles [email protected]
228 verbose rebuildBundles [ 'bindings', 'nan' ]
229 info install [email protected]
230 verbose unsafe-perm in lifecycle false
231 info [email protected] Failed to exec install script
232 verbose unlock done using /root/.npm/_locks/deasync-ef8dd4a1ab973500.lock for /root/node_modules/deasync
233 verbose stack Error: [email protected] install: `node ./build.js`
233 verbose stack Exit status 1
233 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
233 verbose stack     at emitTwo (events.js:87:13)
233 verbose stack     at EventEmitter.emit (events.js:169:7)
233 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:14:12)
233 verbose stack     at emitTwo (events.js:87:13)
233 verbose stack     at ChildProcess.emit (events.js:169:7)
233 verbose stack     at maybeClose (child_process.js:984:16)
233 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1057:5)
234 verbose pkgid [email protected]
235 verbose cwd /root
236 error Linux 3.18.11-1-MANJARO
237 error argv "/usr/bin/iojs" "/usr/bin/npm" "install" "deasync"
238 error node v1.6.4
239 error npm  v2.7.5
240 error code ELIFECYCLE
241 error [email protected] install: `node ./build.js`
241 error Exit status 1
242 error Failed at the [email protected] install script 'node ./build.js'.
242 error This is most likely a problem with the deasync package,
242 error not with npm itself.
242 error Tell the author that this fails on your system:
242 error     node ./build.js
242 error You can get their info via:
242 error     npm owner ls deasync
242 error There is likely additional logging output above.

Could not locate the bindings file

Uncaught Error: Could not locate the bindings file. Tried:
 → deasync\build\deasync.node
 → deasync\build\Debug\deasync.node
 → deasync\build\Release\deasync.node
 → deasync\out\Debug\deasync.node
 → deasync\Debug\deasync.node
 → deasync\out\Release\deasync.node
 → deasync\Release\deasync.node
 → deasync\build\default\deasync.node
 → deasync\compiled\2.3.1\win32\x64\deasync.node

I saw the previous issue that had the same error, and tried the solution (uninstalling and reinstalling) but it didn't seem to do anything (which makes sense because this is from a fresh install anyway).

I tried to do a bit of debugging myself, and none of the paths it tried existed. When it installs, it says the binary is fine but doesn't make any of those paths. Is it supposed to? I tried putting the compiled files into one of the folders (I tried the first one and the last one), but then bindings.js complained about it not self-registering.

Am I doing something wrong, or...?

Why does this require node 0.11?

I looked through the code and the docs and it looks like you aren't doing anything version specific.

I can make a patch if you have any basic information on where the problem lies

clean up your source code

here:

https://github.com/abbr/deasync/blob/master/index.js

module.exports = deasync;

module.exports.sleep = deasync(function(timeout, done) {
    setTimeout(done, timeout);
});

module.exports.runLoopOnce = function(){
    process._tickDomainCallback();
    binding.run();
};

module.exports.loopWhile = function(pred){
  while(pred()){
    process._tickDomainCallback();
    if(pred()) binding.run();
  }
};

change this into:

deasync.sleep = deasync(function(timeout, done) {
    setTimeout(done, timeout);
});

deasync.runLoopOnce = function(){
    process._tickDomainCallback();
    binding.run();
};

deasync.loopWhile = function(pred){
  while(pred()){
    process._tickDomainCallback();
    if(pred()) binding.run();
  }
};

module.exports = deasync;

it's a lot clearer what is going on, this way.

Performance Question

I want to convert LOT OF FUNCTIONS, to deasync functions every time that app process starts...

like this:

 var fs=require('fs')
 var newFunctions={};
 for(var i in fs)
   newFunctions[i]=deasync(fs(i)

 fs=require('anyotherlibrary_like_mysql_mongodb_else')
 for(var i in fs)
   newFunctions[i]=deasync(fs(i)

I am not asking about best practice (is not).
My question is, How many Memory, and CPU deasync using, for creating & storing the deasync's versions of functions.

Unsupported (?) architecture: `arm64`

Installing the module on ARM64 platform fails with the above message. Output of NPM is:

`npm ERR! Linux 3.10.61+
npm ERR! argv "/opt/nodeAPI/bin/Linux-aarch64/node-v4.4.3-linux-arm64/bin/node" "/opt/nodeAPI/bin/Linux-aarch64/node-v4.4.3-linux-arm64/bin/npm" "install" "deasync"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node ./build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node ./build.js'.
npm ERR! This is most likely a problem with the deasync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs deasync
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls deasync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /opt/nodeAPI/bin/Linux-aarch64/node-v4.4.3-linux-arm64/bin/npm-debug.log`

Error logfile is attached.
npm-debug.log.zip

Failed at the [email protected] install script 'node ./build.js'

Hello,

When I install this module with node v5.0.0 I get this error 👍
Failed at the [email protected] install script 'node ./build.js'

5898 silly install deasync /Users/mnicole/Projects/rpi-gsm-print/node_modules/.staging/deasync-e4547bd165efd9ec12e8d632bec051b9
5899 info lifecycle [email protected]~install: [email protected]
5900 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
5901 verbose lifecycle [email protected]~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/mnicole/Projects/rpi-gsm-print/node_modules/deasync/node_modules/.bin:/Users/mnicole/Projects/rpi-gsm-print/node_modules/.bin:/Users/mnicole/drush:/Library/Ruby/Gems/2.0.0/gems/compass-1.0.3/bin:/Library/Ruby/Gems/2.0.0/gems/sass-3.4.14/bin/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
5902 verbose lifecycle [email protected]~install: CWD: /Users/mnicole/Projects/rpi-gsm-print/node_modules/deasync
5903 silly lifecycle [email protected]~install: Args: [ '-c', 'node ./build.js' ]
5904 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
5905 info lifecycle [email protected]~install: Failed to exec install script
5906 verbose unlock done using /Users/mnicole/.npm/_locks/staging-85d8a68bc79d4dbb.lock for /Users/mnicole/Projects/rpi-gsm-print/node_modules/.staging
5907 silly rollbackFailedOptional Starting
5908 silly rollbackFailedOptional Finishing
5909 silly runTopLevelLifecycles Starting
5910 silly runTopLevelLifecycles Finishing
5911 silly install printInstalled
5912 verbose stack Error: [email protected] install: `node ./build.js`
5912 verbose stack Exit status 1
5912 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:233:16)
5912 verbose stack     at emitTwo (events.js:87:13)
5912 verbose stack     at EventEmitter.emit (events.js:172:7)
5912 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
5912 verbose stack     at emitTwo (events.js:87:13)
5912 verbose stack     at ChildProcess.emit (events.js:172:7)
5912 verbose stack     at maybeClose (internal/child_process.js:818:16)
5912 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
5913 verbose pkgid [email protected]

Can you help me to resolve this problem ?

Thanks !

C lib error while dealing with a huge number of calls

I'm using this module in my application to synchronize some calls to mongodb routines, and while I'm testing the application with a HTTP request robot requesting each 100ms, near 50 times (in around 3hr) there was accused an error in the console.

node: ../deps/uv/src/unix/async.c:158: uv__async_io: Assertion n == sizeof(val)' failed.`

And it always appears lots of times in a row.

Failed uv

Using deasync with redis and socket.io
Under part of deasync

  db.select = deasync(db.select);
  db.set = deasync(db.set);
  db.get = deasync(db.get);
  db.del = deasync(db.del);

With many connections the fault message
The failure message in uv

nodejs: ../deps/uv/src/unix/async.c:130: uv__async_io: Assertion `n == sizeof(val)' failed.is:issue is:open 

npm install fails to build on OS X and Travis CI

Heads up that I'm having trouble building on my OS X machine.


child_process: customFds option is deprecated, use stdio instead.
  CXX(target) Release/obj.target/deasync/src/deasync.o
../src/deasync.cc:5:1: error: unknown type name 'uv_idle_t'
uv_idle_t idler;
^
../src/deasync.cc:7:25: error: unknown type name 'uv_idle_t'
static void crunch_away(uv_idle_t* handle, int status) {
                        ^
../src/deasync.cc:11:32: error: unknown type name 'Arguments'; did you mean 'v8::internal::Arguments'?
static Handle<Value> Run(const Arguments& args) {
                               ^~~~~~~~~
                               v8::internal::Arguments
/Users/mac/.node-gyp/0.12.0/deps/v8/include/v8.h:127:7: note: 'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/deasync.cc:12:15: error: calling a protected constructor of class 'v8::HandleScope'
  HandleScope scope;
              ^
/Users/mac/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: note: declared protected here
  V8_INLINE HandleScope() {}
            ^
../src/deasync.cc:14:10: error: use of undeclared identifier 'uv_default_loop'
  uv_run(uv_default_loop(), UV_RUN_ONCE);
         ^
../src/deasync.cc:14:29: error: use of undeclared identifier 'UV_RUN_ONCE'
  uv_run(uv_default_loop(), UV_RUN_ONCE);
                            ^
../src/deasync.cc:15:16: error: no member named 'Close' in 'v8::HandleScope'
  return scope.Close(Undefined());
         ~~~~~ ^
../src/deasync.cc:15:22: error: no matching function for call to 'Undefined'
  return scope.Close(Undefined());
                     ^~~~~~~~~
/Users/mac/.node-gyp/0.12.0/deps/v8/include/v8.h:305:28: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
  friend Handle<Primitive> Undefined(Isolate* isolate);
                           ^
../src/deasync.cc:19:9: error: no member named 'SetMethod' in namespace 'node'
  node::SetMethod(target, "run", Run);
  ~~~~~~^
../src/deasync.cc:20:16: error: use of undeclared identifier 'uv_default_loop'
  uv_idle_init(uv_default_loop(), &idler);
               ^
10 errors generated.
make: *** [Release/obj.target/deasync/src/deasync.o] Error 1


npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "update"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node ./build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node ./build.js'.
npm ERR! This is most likely a problem with the deasync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls deasync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/mac/Documents/Code/ff/npm-debug.log




... Travis

npm WARN deprecated [email protected]: Please use node-xmpp-client / node-xmpp-server / node-xmpp-component
> [email protected] install /home/travis/build/mcnaughton/bot/node_modules/ntwitter/node_modules/keygrip
> [ -x /usr/bin/nodejs ] && /usr/bin/nodejs ./install.js || node ./install.js
> [email protected] install /home/travis/build/mcnaughton/bot/node_modules/node-newrelic-api/node_modules/deasync
> node ./build.js
`linux-x64` exists; testing
Problem with the binary; manual build incoming
child_process: customFds option is deprecated, use stdio instead.
child_process: customFds option is deprecated, use stdio instead.
make: Entering directory `/home/travis/build/mcnaughton/bot/node_modules/node-newrelic-api/node_modules/deasync/build'
  CXX(target) Release/obj.target/deasync/src/deasync.o
../src/deasync.cc:5:1: error: ‘uv_idle_t’ does not name a type
../src/deasync.cc:7:25: error: variable or field ‘crunch_away’ declared void
../src/deasync.cc:7:25: error: ‘uv_idle_t’ was not declared in this scope
../src/deasync.cc:7:36: error: ‘handle’ was not declared in this scope
../src/deasync.cc:7:44: error: expected primary-expression before ‘int’
../src/deasync.cc:11:32: error: ‘Arguments’ does not name a type
../src/deasync.cc:11:43: error: ISO C++ forbids declaration of ‘args’ with no type [-fpermissive]
/home/travis/.node-gyp/0.12.0/deps/v8/include/v8.h: In function ‘v8::Handle<v8::Value> Run(const int&)’:
/home/travis/.node-gyp/0.12.0/deps/v8/include/v8.h:816:13: error: ‘v8::HandleScope::HandleScope()’ is protected
../src/deasync.cc:12:15: error: within this context
../src/deasync.cc:13:18: error: ‘idler’ was not declared in this scope
../src/deasync.cc:13:25: error: ‘crunch_away’ was not declared in this scope
../src/deasync.cc:13:36: error: ‘uv_idle_start’ was not declared in this scope
../src/deasync.cc:14:26: error: ‘uv_default_loop’ was not declared in this scope
../src/deasync.cc:14:29: error: ‘UV_RUN_ONCE’ was not declared in this scope
../src/deasync.cc:14:40: error: ‘uv_run’ was not declared in this scope
../src/deasync.cc:15:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
../src/deasync.cc:15:32: error: too few arguments to function ‘v8::Handle<v8::Primitive> v8::Undefined(v8::Isolate*)’
/home/travis/.node-gyp/0.12.0/deps/v8/include/v8.h:305:28: note: declared here
../src/deasync.cc: In function ‘void Init(v8::Handle<v8::Object>)’:
../src/deasync.cc:19:3: error: ‘SetMethod’ is not a member of ‘node’
../src/deasync.cc:20:32: error: ‘uv_default_loop’ was not declared in this scope
../src/deasync.cc:20:36: error: ‘idler’ was not declared in this scope
../src/deasync.cc:20:41: error: ‘uv_idle_init’ was not declared in this scope
make: *** [Release/obj.target/deasync/src/deasync.o] Error 1
make: Leaving directory `/home/travis/build/mcnaughton/bot/node_modules/node-newrelic-api/node_modules/deasync/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/travis/.nvm/versions/node/v0.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Linux 3.13.0-40-generic
gyp ERR! command "node" "/home/travis/.nvm/versions/node/v0.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/travis/build/mcnaughton/bot/node_modules/node-newrelic-api/node_modules/deasync
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 
Build failed

deasync fails to install on OS X, Linux with iojs v3.1.0

I have updated npm, updated npm's bundled node gyp, and made sure python2.7, gcc, and make are available.

On both systems, deasync installs fine using node v0.12.7. But they both fail when using iojs v3.1.0.

username@hostname:/tmp/blah$ node --version
v0.12.7
username@hostname:/tmp/blah$ npm --version
2.14.0
username@hostname:/tmp/blah$ npm install deasync
-
> [email protected] install /tmp/blah/node_modules/deasync
> node ./build.js

`linux-x64-node-0.12` exists; testing
Binary is fine; exiting
[email protected] node_modules/deasync
├── [email protected]
└── [email protected]
username@hostname:/tmp/blah$ nvm use iojs
Now using io.js v3.1.0 (npm v2.14.0)
username@hostname:/tmp/blah$ rm -rf node_modules/
username@hostname:/tmp/blah$ npm install deasync
-
> [email protected] install /tmp/blah/node_modules/deasync
> node ./build.js

Build failed
npm ERR! Linux 3.16.0-45-generic
npm ERR! argv "/home/username/.nvm/versions/io.js/v3.1.0/bin/iojs" "/home/username/.nvm/versions/io.js/v3.1.0/bin/npm" "install" "deasync"
npm ERR! node v3.1.0
npm ERR! npm  v2.14.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node ./build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node ./build.js'.
npm ERR! This is most likely a problem with the deasync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls deasync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/blah/npm-debug.log

Contents of npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/home/username/.nvm/versions/io.js/v3.1.0/bin/iojs',
1 verbose cli   '/home/username/.nvm/versions/io.js/v3.1.0/bin/npm',
1 verbose cli   'install',
1 verbose cli   'deasync' ]
2 info using [email protected]
3 info using [email protected]
4 verbose install initial load of /tmp/blah/package.json
5 verbose readDependencies loading dependencies from /tmp/blah/package.json
6 silly cache add args [ 'deasync', null ]
7 verbose cache add spec deasync
8 silly cache add parsed spec Result {
8 silly cache add   raw: 'deasync',
8 silly cache add   scope: null,
8 silly cache add   name: 'deasync',
8 silly cache add   rawSpec: '',
8 silly cache add   spec: '*',
8 silly cache add   type: 'range' }
9 silly addNamed deasync@*
10 verbose addNamed "*" is a valid semver range for deasync
11 silly addNameRange { name: 'deasync', range: '*', hasData: false }
12 silly mapToRegistry name deasync
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/deasync
16 verbose addNameRange registry:https://registry.npmjs.org/deasync not in flight; fetching
17 verbose request uri https://registry.npmjs.org/deasync
18 verbose request no auth needed
19 info attempt registry request try #1 at 2:54:37 PM
20 verbose request id f6712b2189575069
21 verbose etag "PBB9ICRPQNBNG4MSAFBCOBAE"
22 http request GET https://registry.npmjs.org/deasync
23 http 304 https://registry.npmjs.org/deasync
24 silly get cb [ 304,
24 silly get   { date: 'Sun, 23 Aug 2015 21:54:37 GMT',
24 silly get     via: '1.1 varnish',
24 silly get     'cache-control': 'max-age=60',
24 silly get     etag: '"PBB9ICRPQNBNG4MSAFBCOBAE"',
24 silly get     age: '0',
24 silly get     connection: 'keep-alive',
24 silly get     'x-served-by': 'cache-sjc3131-SJC',
24 silly get     'x-cache': 'HIT',
24 silly get     'x-cache-hits': '1',
24 silly get     'x-timer': 'S1440366877.374149,VS0,VE154',
24 silly get     vary: 'Accept' } ]
25 verbose etag https://registry.npmjs.org/deasync from cache
26 verbose get saving deasync to /home/username/.npm/registry.npmjs.org/deasync/.cache.json
27 silly addNameRange number 2 { name: 'deasync', range: '*', hasData: true }
28 silly addNameRange versions [ 'deasync',
28 silly addNameRange   [ '0.0.3',
28 silly addNameRange     '0.0.4',
28 silly addNameRange     '0.0.5',
28 silly addNameRange     '0.0.6',
28 silly addNameRange     '0.0.7',
28 silly addNameRange     '0.0.8',
28 silly addNameRange     '0.0.9',
28 silly addNameRange     '0.0.10',
28 silly addNameRange     '0.1.0' ] ]
29 silly addNamed [email protected]
30 verbose addNamed "0.1.0" is a plain semver version for deasync
31 silly cache afterAdd [email protected]
32 verbose afterAdd /home/username/.npm/deasync/0.1.0/package/package.json not in flight; writing
33 verbose afterAdd /home/username/.npm/deasync/0.1.0/package/package.json written
34 silly install resolved [ { name: 'deasync',
34 silly install resolved     version: '0.1.0',
34 silly install resolved     description: 'Turns async function into sync via JavaScript wrapper of Node event loop',
34 silly install resolved     main: 'index.js',
34 silly install resolved     author:
34 silly install resolved      { name: 'Vladimir Kurchatkin',
34 silly install resolved        email: '[email protected]' },
34 silly install resolved     contributors: [ [Object] ],
34 silly install resolved     license: 'MIT',
34 silly install resolved     scripts: { install: 'node ./build.js' },
34 silly install resolved     dependencies: { bindings: '~1.1.1', nan: '^1.6.1' },
34 silly install resolved     repository: { type: 'git', url: 'git+https://github.com/abbr/deasync.git' },
34 silly install resolved     homepage: 'https://github.com/abbr/deasync',
34 silly install resolved     keywords: [ 'async', 'sync', 'sleep', 'async wrapper' ],
34 silly install resolved     engines: { node: '>=0.11.0' },
34 silly install resolved     gitHead: '6b6885f081ce8922afdffcf2e10b73a0e531ae45',
34 silly install resolved     bugs: { url: 'https://github.com/abbr/deasync/issues' },
34 silly install resolved     _id: '[email protected]',
34 silly install resolved     _shasum: '65cd8d0bd1023203e42e87c222586c2f8e140337',
34 silly install resolved     _from: 'deasync@*',
34 silly install resolved     _npmVersion: '2.5.1',
34 silly install resolved     _nodeVersion: '0.12.0',
34 silly install resolved     _npmUser: { name: 'abbr', email: '[email protected]' },
34 silly install resolved     maintainers: [ [Object] ],
34 silly install resolved     dist:
34 silly install resolved      { shasum: '65cd8d0bd1023203e42e87c222586c2f8e140337',
34 silly install resolved        tarball: 'http://registry.npmjs.org/deasync/-/deasync-0.1.0.tgz' },
34 silly install resolved     directories: {},
34 silly install resolved     _resolved: 'https://registry.npmjs.org/deasync/-/deasync-0.1.0.tgz',
34 silly install resolved     readme: 'ERROR: No README data found!' } ]
35 info install [email protected] into /tmp/blah
36 info installOne [email protected]
37 verbose installOne of deasync to /tmp/blah not in flight; installing
38 verbose lock using /home/username/.npm/_locks/deasync-2dcaac3007eb38c2.lock for /tmp/blah/node_modules/deasync
39 silly install write writing deasync 0.1.0 to /tmp/blah/node_modules/deasync
40 verbose unbuild node_modules/deasync
41 silly gentlyRm /tmp/blah/node_modules/deasync is being purged from base /tmp/blah
42 verbose gentlyRm don't care about contents; nuking /tmp/blah/node_modules/deasync
43 verbose tar unpack /home/username/.npm/deasync/0.1.0/package.tgz
44 verbose tar unpacking to /tmp/blah/node_modules/deasync
45 silly gentlyRm /tmp/blah/node_modules/deasync is being purged
46 verbose gentlyRm don't care about contents; nuking /tmp/blah/node_modules/deasync
47 silly gunzTarPerm modes [ '775', '664' ]
48 silly gunzTarPerm extractEntry package.json
49 silly gunzTarPerm extractEntry .npmignore
50 silly gunzTarPerm extractEntry README.md
51 silly gunzTarPerm modified mode [ 'README.md', 420, 436 ]
52 silly gunzTarPerm extractEntry test.js
53 silly gunzTarPerm modified mode [ 'test.js', 420, 436 ]
54 silly gunzTarPerm extractEntry quick-test.js
55 silly gunzTarPerm extractEntry index.js
56 silly gunzTarPerm modified mode [ 'index.js', 420, 436 ]
57 silly gunzTarPerm extractEntry build.js
58 silly gunzTarPerm extractEntry binding.gyp
59 silly gunzTarPerm extractEntry bin/linux-x64-node-0.11/deasync.node
60 silly gunzTarPerm modified mode [ 'bin/linux-x64-node-0.11/deasync.node', 493, 509 ]
61 silly gunzTarPerm extractEntry bin/darwin-x64-node-0.10/deasync.node
62 silly gunzTarPerm modified mode [ 'bin/darwin-x64-node-0.10/deasync.node', 493, 509 ]
63 silly gunzTarPerm extractEntry bin/darwin-x64-node-0.12/deasync.node
64 silly gunzTarPerm modified mode [ 'bin/darwin-x64-node-0.12/deasync.node', 493, 509 ]
65 silly gunzTarPerm extractEntry bin/linux-ia32-node-0.10/deasync.node
66 silly gunzTarPerm modified mode [ 'bin/linux-ia32-node-0.10/deasync.node', 493, 509 ]
67 silly gunzTarPerm extractEntry bin/linux-ia32-node-0.11/deasync.node
68 silly gunzTarPerm modified mode [ 'bin/linux-ia32-node-0.11/deasync.node', 493, 509 ]
69 silly gunzTarPerm extractEntry bin/linux-ia32-node-0.12/deasync.node
70 silly gunzTarPerm modified mode [ 'bin/linux-ia32-node-0.12/deasync.node', 493, 509 ]
71 silly gunzTarPerm extractEntry bin/linux-x64-node-0.10/deasync.node
72 silly gunzTarPerm modified mode [ 'bin/linux-x64-node-0.10/deasync.node', 493, 509 ]
73 silly gunzTarPerm extractEntry bin/darwin-x64-node-0.11/deasync.node
74 silly gunzTarPerm modified mode [ 'bin/darwin-x64-node-0.11/deasync.node', 493, 509 ]
75 silly gunzTarPerm extractEntry bin/linux-x64-node-0.12/deasync.node
76 silly gunzTarPerm modified mode [ 'bin/linux-x64-node-0.12/deasync.node', 493, 509 ]
77 silly gunzTarPerm extractEntry bin/win32-ia32-node-0.10/deasync.node
78 silly gunzTarPerm modified mode [ 'bin/win32-ia32-node-0.10/deasync.node', 420, 436 ]
79 silly gunzTarPerm extractEntry bin/win32-ia32-node-0.11/deasync.node
80 silly gunzTarPerm modified mode [ 'bin/win32-ia32-node-0.11/deasync.node', 420, 436 ]
81 silly gunzTarPerm extractEntry bin/win32-ia32-node-0.12/deasync.node
82 silly gunzTarPerm modified mode [ 'bin/win32-ia32-node-0.12/deasync.node', 420, 436 ]
83 silly gunzTarPerm extractEntry bin/win32-x64-node-0.10/deasync.node
84 silly gunzTarPerm modified mode [ 'bin/win32-x64-node-0.10/deasync.node', 420, 436 ]
85 silly gunzTarPerm extractEntry bin/win32-x64-node-0.11/deasync.node
86 silly gunzTarPerm modified mode [ 'bin/win32-x64-node-0.11/deasync.node', 420, 436 ]
87 silly gunzTarPerm extractEntry bin/win32-x64-node-0.12/deasync.node
88 silly gunzTarPerm modified mode [ 'bin/win32-x64-node-0.12/deasync.node', 420, 436 ]
89 silly gunzTarPerm extractEntry src/deasync.cc
90 silly gunzTarPerm modified mode [ 'src/deasync.cc', 420, 436 ]
91 verbose write writing to /tmp/blah/node_modules/deasync/package.json
92 info preinstall [email protected]
93 verbose readDependencies loading dependencies from /tmp/blah/node_modules/deasync/package.json
94 silly prepareForInstallMany adding bindings@~1.1.1 from deasync dependencies
95 silly prepareForInstallMany adding nan@^1.6.1 from deasync dependencies
96 verbose readDependencies loading dependencies from /tmp/blah/node_modules/deasync/package.json
97 silly cache add args [ 'nan@^1.6.1', null ]
98 verbose cache add spec nan@^1.6.1
99 silly cache add parsed spec Result {
99 silly cache add   raw: 'nan@^1.6.1',
99 silly cache add   scope: null,
99 silly cache add   name: 'nan',
99 silly cache add   rawSpec: '^1.6.1',
99 silly cache add   spec: '>=1.6.1 <2.0.0',
99 silly cache add   type: 'range' }
100 silly addNamed nan@>=1.6.1 <2.0.0
101 verbose addNamed ">=1.6.1 <2.0.0" is a valid semver range for nan
102 silly addNameRange { name: 'nan', range: '>=1.6.1 <2.0.0', hasData: false }
103 silly mapToRegistry name nan
104 silly mapToRegistry using default registry
105 silly mapToRegistry registry https://registry.npmjs.org/
106 silly mapToRegistry uri https://registry.npmjs.org/nan
107 verbose addNameRange registry:https://registry.npmjs.org/nan not in flight; fetching
108 silly cache add args [ 'bindings@~1.1.1', null ]
109 verbose cache add spec bindings@~1.1.1
110 silly cache add parsed spec Result {
110 silly cache add   raw: 'bindings@~1.1.1',
110 silly cache add   scope: null,
110 silly cache add   name: 'bindings',
110 silly cache add   rawSpec: '~1.1.1',
110 silly cache add   spec: '>=1.1.1 <1.2.0',
110 silly cache add   type: 'range' }
111 silly addNamed bindings@>=1.1.1 <1.2.0
112 verbose addNamed ">=1.1.1 <1.2.0" is a valid semver range for bindings
113 silly addNameRange { name: 'bindings', range: '>=1.1.1 <1.2.0', hasData: false }
114 silly mapToRegistry name bindings
115 silly mapToRegistry using default registry
116 silly mapToRegistry registry https://registry.npmjs.org/
117 silly mapToRegistry uri https://registry.npmjs.org/bindings
118 verbose addNameRange registry:https://registry.npmjs.org/bindings not in flight; fetching
119 verbose request uri https://registry.npmjs.org/bindings
120 verbose request no auth needed
121 info attempt registry request try #1 at 2:54:37 PM
122 verbose etag "BCS5XYG9ISNJFNKEL5FLOI5HX"
123 http request GET https://registry.npmjs.org/bindings
124 verbose request uri https://registry.npmjs.org/nan
125 verbose request no auth needed
126 info attempt registry request try #1 at 2:54:37 PM
127 verbose etag "41PIK59ZUA3ADEJCQ281I0TDQ"
128 http request GET https://registry.npmjs.org/nan
129 http 304 https://registry.npmjs.org/nan
130 silly get cb [ 304,
130 silly get   { date: 'Sun, 23 Aug 2015 21:54:37 GMT',
130 silly get     via: '1.1 varnish',
130 silly get     'cache-control': 'max-age=60',
130 silly get     etag: '"41PIK59ZUA3ADEJCQ281I0TDQ"',
130 silly get     age: '4',
130 silly get     connection: 'keep-alive',
130 silly get     'x-served-by': 'cache-sjc3132-SJC',
130 silly get     'x-cache': 'HIT',
130 silly get     'x-cache-hits': '1',
130 silly get     'x-timer': 'S1440366877.773933,VS0,VE0',
130 silly get     vary: 'Accept' } ]
131 verbose etag https://registry.npmjs.org/nan from cache
132 verbose get saving nan to /home/username/.npm/registry.npmjs.org/nan/.cache.json
133 silly addNameRange number 2 { name: 'nan', range: '>=1.6.1 <2.0.0', hasData: true }
134 silly addNameRange versions [ 'nan',
134 silly addNameRange   [ '0.3.0-wip',
134 silly addNameRange     '0.3.0-wip2',
134 silly addNameRange     '0.3.0',
134 silly addNameRange     '0.3.1',
134 silly addNameRange     '0.3.2',
134 silly addNameRange     '0.4.0',
134 silly addNameRange     '0.4.1',
134 silly addNameRange     '0.4.2',
134 silly addNameRange     '0.4.3',
134 silly addNameRange     '0.4.4',
134 silly addNameRange     '0.5.0',
134 silly addNameRange     '0.5.1',
134 silly addNameRange     '0.5.2',
134 silly addNameRange     '0.6.0',
134 silly addNameRange     '0.7.0',
134 silly addNameRange     '0.7.1',
134 silly addNameRange     '0.8.0',
134 silly addNameRange     '1.0.0',
134 silly addNameRange     '1.1.0',
134 silly addNameRange     '1.1.1',
134 silly addNameRange     '1.1.2',
134 silly addNameRange     '1.2.0',
134 silly addNameRange     '1.3.0',
134 silly addNameRange     '1.4.0',
134 silly addNameRange     '1.4.1',
134 silly addNameRange     '1.5.0',
134 silly addNameRange     '1.4.2',
134 silly addNameRange     '1.4.3',
134 silly addNameRange     '1.5.1',
134 silly addNameRange     '1.5.2',
134 silly addNameRange     '1.6.0',
134 silly addNameRange     '1.5.3',
134 silly addNameRange     '1.6.1',
134 silly addNameRange     '1.6.2',
134 silly addNameRange     '1.7.0',
134 silly addNameRange     '1.8.0',
134 silly addNameRange     '1.8.1',
134 silly addNameRange     '1.8.2',
134 silly addNameRange     '1.8.3',
134 silly addNameRange     '1.8.4',
134 silly addNameRange     '1.9.0',
134 silly addNameRange     '2.0.0',
134 silly addNameRange     '2.0.1',
134 silly addNameRange     '2.0.2',
134 silly addNameRange     '2.0.3',
134 silly addNameRange     '2.0.4',
134 silly addNameRange     '2.0.5' ] ]
135 silly addNamed [email protected]
136 verbose addNamed "1.9.0" is a plain semver version for nan
137 silly cache afterAdd [email protected]
138 verbose afterAdd /home/username/.npm/nan/1.9.0/package/package.json not in flight; writing
139 verbose afterAdd /home/username/.npm/nan/1.9.0/package/package.json written
140 http 304 https://registry.npmjs.org/bindings
141 silly get cb [ 304,
141 silly get   { date: 'Sun, 23 Aug 2015 21:54:37 GMT',
141 silly get     via: '1.1 varnish',
141 silly get     'cache-control': 'max-age=60',
141 silly get     etag: '"BCS5XYG9ISNJFNKEL5FLOI5HX"',
141 silly get     age: '39',
141 silly get     connection: 'keep-alive',
141 silly get     'x-served-by': 'cache-lax1428-LAX',
141 silly get     'x-cache': 'HIT',
141 silly get     'x-cache-hits': '1',
141 silly get     'x-timer': 'S1440366877.827419,VS0,VE0',
141 silly get     vary: 'Accept' } ]
142 verbose etag https://registry.npmjs.org/bindings from cache
143 verbose get saving bindings to /home/username/.npm/registry.npmjs.org/bindings/.cache.json
144 silly addNameRange number 2 { name: 'bindings', range: '>=1.1.1 <1.2.0', hasData: true }
145 silly addNameRange versions [ 'bindings',
145 silly addNameRange   [ '0.0.1',
145 silly addNameRange     '0.1.0',
145 silly addNameRange     '0.1.1',
145 silly addNameRange     '0.2.0',
145 silly addNameRange     '0.2.1',
145 silly addNameRange     '0.2.2',
145 silly addNameRange     '0.2.3',
145 silly addNameRange     '0.2.4',
145 silly addNameRange     '0.3.0',
145 silly addNameRange     '0.4.0',
145 silly addNameRange     '1.0.0',
145 silly addNameRange     '1.1.0',
145 silly addNameRange     '1.1.1',
145 silly addNameRange     '1.2.0',
145 silly addNameRange     '1.2.1' ] ]
146 silly addNamed [email protected]
147 verbose addNamed "1.1.1" is a plain semver version for bindings
148 silly cache afterAdd [email protected]
149 verbose afterAdd /home/username/.npm/bindings/1.1.1/package/package.json not in flight; writing
150 verbose afterAdd /home/username/.npm/bindings/1.1.1/package/package.json written
151 silly install resolved [ { name: 'nan',
151 silly install resolved     version: '1.9.0',
151 silly install resolved     description: 'Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility',
151 silly install resolved     main: 'include_dirs.js',
151 silly install resolved     repository: { type: 'git', url: 'git://github.com/nodejs/nan.git' },
151 silly install resolved     scripts:
151 silly install resolved      { test: 'tap --gc test/js/*-test.js',
151 silly install resolved        'rebuild-tests': 'pangyp rebuild --msvs_version=2013 --directory test' },
151 silly install resolved     contributors:
151 silly install resolved      [ [Object],
151 silly install resolved        [Object],
151 silly install resolved        [Object],
151 silly install resolved        [Object],
151 silly install resolved        [Object],
151 silly install resolved        [Object],
151 silly install resolved        [Object] ],
151 silly install resolved     devDependencies:
151 silly install resolved      { bindings: '~1.2.1',
151 silly install resolved        'node-gyp': '~2.0.2',
151 silly install resolved        pangyp: '~2.2.0',
151 silly install resolved        tap: '~0.7.1',
151 silly install resolved        xtend: '~4.0.0' },
151 silly install resolved     license: 'MIT',
151 silly install resolved     gitHead: '399b3a54ada39a7cf7a11978ea727eae3686666e',
151 silly install resolved     bugs: { url: 'https://github.com/nodejs/nan/issues' },
151 silly install resolved     homepage: 'https://github.com/nodejs/nan#readme',
151 silly install resolved     _id: '[email protected]',
151 silly install resolved     _shasum: '1a9cd2755609766f5c291e4194fce39fde286515',
151 silly install resolved     _from: 'nan@>=1.6.1 <2.0.0',
151 silly install resolved     _npmVersion: '2.13.3',
151 silly install resolved     _nodeVersion: '0.12.2',
151 silly install resolved     _npmUser: { name: 'kkoopa', email: '[email protected]' },
151 silly install resolved     maintainers: [ [Object], [Object] ],
151 silly install resolved     dist:
151 silly install resolved      { shasum: '1a9cd2755609766f5c291e4194fce39fde286515',
151 silly install resolved        tarball: 'http://registry.npmjs.org/nan/-/nan-1.9.0.tgz' },
151 silly install resolved     directories: {},
151 silly install resolved     _resolved: 'https://registry.npmjs.org/nan/-/nan-1.9.0.tgz',
151 silly install resolved     readme: 'ERROR: No README data found!' },
151 silly install resolved   { name: 'bindings',
151 silly install resolved     description: 'Helper module for loading your native module\'s .node file',
151 silly install resolved     keywords: [ 'native', 'addon', 'bindings', 'gyp', 'waf', 'c', 'c++' ],
151 silly install resolved     version: '1.1.1',
151 silly install resolved     author:
151 silly install resolved      { name: 'Nathan Rajlich',
151 silly install resolved        email: '[email protected]',
151 silly install resolved        url: 'http://tootallnate.net' },
151 silly install resolved     repository:
151 silly install resolved      { type: 'git',
151 silly install resolved        url: 'git://github.com/TooTallNate/node-bindings.git' },
151 silly install resolved     main: './bindings.js',
151 silly install resolved     bugs: { url: 'https://github.com/TooTallNate/node-bindings/issues' },
151 silly install resolved     _id: '[email protected]',
151 silly install resolved     dist:
151 silly install resolved      { shasum: '951f7ae010302ffc50b265b124032017ed2bf6f3',
151 silly install resolved        tarball: 'http://registry.npmjs.org/bindings/-/bindings-1.1.1.tgz' },
151 silly install resolved     _from: 'bindings@>=1.1.1 <1.2.0',
151 silly install resolved     _npmVersion: '1.3.2',
151 silly install resolved     _npmUser: { name: 'tootallnate', email: '[email protected]' },
151 silly install resolved     maintainers: [ [Object], [Object] ],
151 silly install resolved     directories: {},
151 silly install resolved     _shasum: '951f7ae010302ffc50b265b124032017ed2bf6f3',
151 silly install resolved     _resolved: 'https://registry.npmjs.org/bindings/-/bindings-1.1.1.tgz',
151 silly install resolved     readme: 'ERROR: No README data found!',
151 silly install resolved     homepage: 'https://github.com/TooTallNate/node-bindings#readme' } ]
152 info install [email protected] into /tmp/blah/node_modules/deasync
153 info install [email protected] into /tmp/blah/node_modules/deasync
154 info installOne [email protected]
155 verbose installOne of nan to /tmp/blah/node_modules/deasync not in flight; installing
156 info installOne [email protected]
157 verbose installOne of bindings to /tmp/blah/node_modules/deasync not in flight; installing
158 verbose lock using /home/username/.npm/_locks/bindings-2e912170e2fb0afe.lock for /tmp/blah/node_modules/deasync/node_modules/bindings
159 verbose lock using /home/username/.npm/_locks/nan-5fde3b580ebbdc2f.lock for /tmp/blah/node_modules/deasync/node_modules/nan
160 silly install write writing bindings 1.1.1 to /tmp/blah/node_modules/deasync/node_modules/bindings
161 silly install write writing nan 1.9.0 to /tmp/blah/node_modules/deasync/node_modules/nan
162 verbose unbuild node_modules/deasync/node_modules/bindings
163 verbose unbuild node_modules/deasync/node_modules/nan
164 silly gentlyRm /tmp/blah/node_modules/deasync/node_modules/bindings is being purged from base /tmp/blah
165 verbose gentlyRm don't care about contents; nuking /tmp/blah/node_modules/deasync/node_modules/bindings
166 verbose tar unpack /home/username/.npm/bindings/1.1.1/package.tgz
167 verbose tar unpacking to /tmp/blah/node_modules/deasync/node_modules/bindings
168 silly gentlyRm /tmp/blah/node_modules/deasync/node_modules/bindings is being purged
169 verbose gentlyRm don't care about contents; nuking /tmp/blah/node_modules/deasync/node_modules/bindings
170 silly gentlyRm /tmp/blah/node_modules/deasync/node_modules/nan is being purged from base /tmp/blah
171 verbose gentlyRm don't care about contents; nuking /tmp/blah/node_modules/deasync/node_modules/nan
172 silly gunzTarPerm modes [ '775', '664' ]
173 verbose tar unpack /home/username/.npm/nan/1.9.0/package.tgz
174 verbose tar unpacking to /tmp/blah/node_modules/deasync/node_modules/nan
175 silly gentlyRm /tmp/blah/node_modules/deasync/node_modules/nan is being purged
176 verbose gentlyRm don't care about contents; nuking /tmp/blah/node_modules/deasync/node_modules/nan
177 silly gunzTarPerm modes [ '775', '664' ]
178 silly gunzTarPerm extractEntry package.json
179 silly gunzTarPerm modified mode [ 'package.json', 420, 436 ]
180 silly gunzTarPerm extractEntry package.json
181 silly gunzTarPerm extractEntry README.md
182 silly gunzTarPerm modified mode [ 'README.md', 420, 436 ]
183 silly gunzTarPerm extractEntry bindings.js
184 silly gunzTarPerm modified mode [ 'bindings.js', 420, 436 ]
185 silly gunzTarPerm extractEntry README.md
186 silly gunzTarPerm extractEntry include_dirs.js
187 silly gunzTarPerm extractEntry LICENSE.md
188 silly gunzTarPerm extractEntry .dntrc
189 silly gunzTarPerm extractEntry appveyor.yml
190 verbose write writing to /tmp/blah/node_modules/deasync/node_modules/bindings/package.json
191 silly gunzTarPerm extractEntry nan.h
192 info preinstall [email protected]
193 verbose readDependencies loading dependencies from /tmp/blah/node_modules/deasync/node_modules/bindings/package.json
194 verbose readDependencies loading dependencies from /tmp/blah/node_modules/deasync/node_modules/bindings/package.json
195 silly install resolved []
196 verbose about to build /tmp/blah/node_modules/deasync/node_modules/bindings
197 info build /tmp/blah/node_modules/deasync/node_modules/bindings
198 info linkStuff [email protected]
199 silly linkStuff [email protected] has /tmp/blah/node_modules/deasync/node_modules as its parent node_modules
200 verbose linkBins [email protected]
201 verbose linkMans [email protected]
202 verbose rebuildBundles [email protected]
203 info install [email protected]
204 info postinstall [email protected]
205 verbose unlock done using /home/username/.npm/_locks/bindings-2e912170e2fb0afe.lock for /tmp/blah/node_modules/deasync/node_modules/bindings
206 silly gunzTarPerm extractEntry nan_implementation_12_inl.h
207 silly gunzTarPerm extractEntry nan_implementation_pre_12_inl.h
208 silly gunzTarPerm extractEntry nan_new.h
209 silly gunzTarPerm extractEntry nan_string_bytes.h
210 silly gunzTarPerm extractEntry CHANGELOG.md
211 silly gunzTarPerm extractEntry tools/node_modules/commander/package.json
212 silly gunzTarPerm extractEntry tools/node_modules/commander/LICENSE
213 silly gunzTarPerm extractEntry tools/node_modules/commander/index.js
214 silly gunzTarPerm extractEntry tools/node_modules/commander/History.md
215 silly gunzTarPerm extractEntry tools/node_modules/commander/Readme.md
216 silly gunzTarPerm extractEntry tools/node_modules/commander/node_modules/graceful-readlink/package.json
217 silly gunzTarPerm extractEntry tools/node_modules/commander/node_modules/graceful-readlink/.npmignore
218 silly gunzTarPerm extractEntry tools/node_modules/commander/node_modules/graceful-readlink/README.md
219 silly gunzTarPerm extractEntry tools/node_modules/commander/node_modules/graceful-readlink/LICENSE
220 silly gunzTarPerm extractEntry tools/node_modules/commander/node_modules/graceful-readlink/index.js
221 silly gunzTarPerm extractEntry tools/node_modules/commander/node_modules/graceful-readlink/.travis.yml
222 silly gunzTarPerm extractEntry tools/node_modules/glob/package.json
223 silly gunzTarPerm extractEntry tools/node_modules/glob/README.md
224 silly gunzTarPerm extractEntry tools/node_modules/glob/LICENSE
225 silly gunzTarPerm extractEntry tools/node_modules/glob/common.js
226 silly gunzTarPerm extractEntry tools/node_modules/glob/glob.js
227 silly gunzTarPerm extractEntry tools/node_modules/glob/sync.js
228 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/package.json
229 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/README.md
230 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/LICENSE
231 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/inflight.js
232 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/test.js
233 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/.eslintrc
234 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json
235 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md
236 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE
237 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js
238 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js
239 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inherits/package.json
240 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inherits/README.md
241 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inherits/LICENSE
242 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inherits/inherits.js
243 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inherits/inherits_browser.js
244 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/inherits/test.js
245 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/package.json
246 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/README.md
247 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/LICENSE
248 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/browser.js
249 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/minimatch.js
250 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json
251 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore
252 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md
253 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js
254 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js
255 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml
256 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js
257 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js
258 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js
259 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js
260 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js
261 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js
262 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js
263 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js
264 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js
265 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt
266 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh
267 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt
268 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json
269 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore
270 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md
271 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js
272 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js
273 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml
274 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile
275 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js
276 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json
277 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE
278 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js
279 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml
280 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown
281 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js
282 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js
283 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/package.json
284 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/README.md
285 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/LICENSE
286 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/once.js
287 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/test/once.js
288 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/node_modules/wrappy/package.json
289 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/node_modules/wrappy/README.md
290 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE
291 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js
292 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js
293 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/path-is-absolute/package.json
294 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/path-is-absolute/index.js
295 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/path-is-absolute/license
296 silly gunzTarPerm extractEntry tools/node_modules/glob/node_modules/path-is-absolute/readme.md
297 verbose write writing to /tmp/blah/node_modules/deasync/node_modules/nan/package.json
298 info preinstall [email protected]
299 verbose readDependencies loading dependencies from /tmp/blah/node_modules/deasync/node_modules/nan/package.json
300 verbose readDependencies loading dependencies from /tmp/blah/node_modules/deasync/node_modules/nan/package.json
301 silly install resolved []
302 verbose about to build /tmp/blah/node_modules/deasync/node_modules/nan
303 info build /tmp/blah/node_modules/deasync/node_modules/nan
304 info linkStuff [email protected]
305 silly linkStuff [email protected] has /tmp/blah/node_modules/deasync/node_modules as its parent node_modules
306 verbose linkBins [email protected]
307 verbose linkMans [email protected]
308 verbose rebuildBundles [email protected]
309 info install [email protected]
310 info postinstall [email protected]
311 verbose unlock done using /home/username/.npm/_locks/nan-5fde3b580ebbdc2f.lock for /tmp/blah/node_modules/deasync/node_modules/nan
312 verbose about to build /tmp/blah/node_modules/deasync
313 info build /tmp/blah/node_modules/deasync
314 info linkStuff [email protected]
315 silly linkStuff [email protected] has /tmp/blah/node_modules as its parent node_modules
316 verbose linkBins [email protected]
317 verbose linkMans [email protected]
318 verbose rebuildBundles [email protected]
319 verbose rebuildBundles [ 'bindings', 'nan' ]
320 info install [email protected]
321 verbose unsafe-perm in lifecycle true
322 info [email protected] Failed to exec install script
323 verbose unlock done using /home/username/.npm/_locks/deasync-2dcaac3007eb38c2.lock for /tmp/blah/node_modules/deasync
324 verbose stack Error: [email protected] install: `node ./build.js`
324 verbose stack Exit status 1
324 verbose stack     at EventEmitter.<anonymous> (/home/username/.nvm/versions/io.js/v3.1.0/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
324 verbose stack     at emitTwo (events.js:87:13)
324 verbose stack     at EventEmitter.emit (events.js:172:7)
324 verbose stack     at ChildProcess.<anonymous> (/home/username/.nvm/versions/io.js/v3.1.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
324 verbose stack     at emitTwo (events.js:87:13)
324 verbose stack     at ChildProcess.emit (events.js:172:7)
324 verbose stack     at maybeClose (internal/child_process.js:764:16)
324 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
325 verbose pkgid [email protected]
326 verbose cwd /tmp/blah
327 error Linux 3.16.0-45-generic
328 error argv "/home/username/.nvm/versions/io.js/v3.1.0/bin/iojs" "/home/username/.nvm/versions/io.js/v3.1.0/bin/npm" "install" "deasync"
329 error node v3.1.0
330 error npm  v2.14.0
331 error code ELIFECYCLE
332 error [email protected] install: `node ./build.js`
332 error Exit status 1
333 error Failed at the [email protected] install script 'node ./build.js'.
333 error This is most likely a problem with the deasync package,
333 error not with npm itself.
333 error Tell the author that this fails on your system:
333 error     node ./build.js
333 error You can get their info via:
333 error     npm owner ls deasync
333 error There is likely additional logging output above.
334 verbose exit [ 1, true ]
335 verbose unbuild node_modules/deasync
336 info preuninstall [email protected]
337 info uninstall [email protected]
338 verbose unbuild rmStuff [email protected] from /tmp/blah/node_modules
339 info postuninstall [email protected]
340 silly gentlyRm /tmp/blah/node_modules/deasync is being purged from base /tmp/blah
341 verbose gentlyRm don't care about contents; nuking /tmp/blah/node_modules/deasync
342 silly vacuum-fs purging /tmp/blah/node_modules/deasync
343 silly vacuum-fs removing /tmp/blah/node_modules
344 silly vacuum-fs finished vacuuming up to /tmp/blah

Segmentation fault (core dumped)

Hi there,

I was trying to execute this piece of code:

const net = require('net');
const deasync = require('deasync');
var reachable = false;
var cont = 0;
var retries = 4;
while (!reachable && cont < retries) {
  var done = false;
  var connection = net.connect({host: '127.0.0.1', port: 12123}, () => {
    done = true;
    reachable = true;
  });
  connection.on('error', () => {
    cont += 1;
    deasync.sleep(1000);
    done = true;
  });
  deasync.loopWhile(() => { return !done;});
  console.log('Retrying');
}

While the process is blocked in deasync.loopWhile, the deasync.sleep causes the mentioned core dumped. (Executed in Linux x64 with Node v4.2.2 and deasync v0.1.4). Placing the sleep after the loop works in the example but I wanted to let you know about the issue.

Update docs or logging in console regarding compatibility with node versions

Please update your docs to clarify that the user has to use a node version >v0.11. I didn't notice it, and I spent hours to find out that it's not working with v0.10 (with mongoose queries). You could also print an error in the console that it needs a newer version (I would prefer that you do both).
The engines field in the package.json is advisory only and you won't notice it.
Thank you!

Not Working on production while locally on dev it works fine. - VERY STRANGE

Hi Abbr,

i have the following code which run with Node.js (v4.2.2)+ Express.js(v~4.13.1).

var request = require('request');
var deasync = require('deasync');
request = request.defaults({jar: true});
function doSomething() {
        var done = false;
        var data;
        request("https://www.google.co.il/search?gws_rd=ssl&site=&source=hp&q=test", function (err, res, body) {
            if(err) {console.log(err);return;}
            data = "Test";
            done=true;
        });
        deasync.loopWhile(function () {
            return !done;
        });
        return data;
    }
exports.doSomething = doSomething;

On my local machine (Macbook pro V10.11.1) the code works as expected no matter where and when i call the above function.
However, on a Ubuntu machine, the code runs if i call it directly from the router.get() function, but if i call it from a nested callback environment, it will never stop looping. actually, the request() is starting but never starting its callback.
Examples:
here is the file router/index.js: which executed as expected all the time

var express = require('express');
var router = express.Router();
var request = require('request');
request = request.defaults({jar: true});
var deasync = require('deasync');
var doSomething = require(PATH_TO_DOSOMETHING);
router.get('/', function(req, res, next) {
    var text = doSomething.doSomething();
    res.send(text);
});

It will be hard to write all the code that doesn't work, but I'll try to give you an idea about when your code is called and the same doSomething() is stuck.
This is another router....

router.get('/', function(req, res, next) {
Indicative.validate(rules, paramsObj)  // Indicative is a validation library
        .then(function (success) {
            //we passed the validation. start processing the request
            Promise.join(//Bluebird function
                 Users.find().execAsync(),//mongoose call after it got promisification by bluebird
                 Cars.find().execAsync(),
                 function(users,cars){

                      bl.callStateMachine();//bl is a statemachine from the project stately.js
                                                         //AND doSomething() is called from within the statemachine.
                 }
             );
            });
});

I know its a big mess, but maybe you have a clue where to start?

combination lwip imageprocessing / deasync fails

Im trying to batch scale / process photos and do other manipulations on many images (and other files) in a dir tree. No need to do asynchronously and deasync would make resulting code more readable (at least for me). The Lwip library looked nice as it has no dependencies.

but the code below fails:

node_modules/lwip/lib/ImagePrototypeInit.js:97
this.__lock();
^
TypeError: undefined is not a function
at Image.scale (node_modules/lwip/lib/ImagePrototypeInit.js:97:14)
at node_modules/deasync/index.js:35:6
at Object. (deasynctest.js:18:29)

maybe because lwip uses async? Simple code (requires a photo.jpg file)

var lwip = require('lwip');

// normal lwip interface, working fine
lwip.open('photo.jpg', function (err, image) {
    image.scale(0.5, function (err, image) {
        image.writeFile('photoasync.jpg', function (err) {
       })
    })
});

// using deasync
var deasync = require('deasync');

var image = deasync(lwip.open)('photo.jpg'); // works (nice!)
console.log('opened');
image = deasync(image.scale)(0.5); // fails
console.log('scaled');
deasync(image.writeFile)('photosync.jpg'); // fails (even without scaling)
console.log('written');

using deasync 0.1.4 and lwip 0.0.8

Use mongoose with deasync - what is the right way?

Hey, thanks for the library!

in your "Usages" section you refer to standard and non-standard API signatures.
I was wondering which approach will best suit the find() method of mongoose?
A code example will be great.

Thanks!

Node v4

I just upgraded to Node v4. Ran an npm install with a package.json that uses massive js which depends on deasync. The error seems to do with deasync. Any ideas on what's going on here?

npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "update"
npm ERR! node v4.0.0
npm ERR! npm v2.14.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node ./build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node ./build.js'.
npm ERR! This is most likely a problem with the deasync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./build.js
npm ERR! You can get their info via:
npm ERR! npm owner ls deasync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/kevinlint/Dev/valtworks/rawapi/npm-debug.log

Invoking object methods loses object context

Hey!

The issue:
when invoking deasync(obj.fun), where obj is an object created with 'new' (and perhaps with some fields populated in its contructor), the object context and its fields are lost, due to this line. This will probably lead to an Error due to use of undefined variables in obj.fun.

My test case (using gift library):

// git.js
var deasync = require('deasync');
var gift = require('gift');

var git = module.exports = function (repoPath) {
    var repo = gift(repoPath);

    // Following commented code works works:
    // var done = false;
    // var head = null;
    // var err = null;

    // repo.branch(function (terr, thead) {
    //     if (err) { err = terr; }
    //     head = thead;
    //     done = true;
    // });

    // while (!done) {
    //     deasync.runLoopOnce();
    // }

    // if (err) { throw err; }
    // if (!head) { throw new Error('Could not load git branch data'); }
    // return head;

    // But this fails:
    var branchSync = deasync(repo.branch);
    var head = branchSync();

    return head;
};
// app.js
var GIT_DATA = require('./git')(__dirname);

There is a Git repository at /home/example/path/.git

Commented code fails with:

Error: ENOENT, open 'undefined/HEAD'
    at Function.module.exports.runLoopOnce (/home/example/path/node_modules/deasync/index.js:54:10)
    at /home/example/path/node_modules/deasync/index.js:31:19
    at module.exports (/home/example/path/git.js:29:16)
    at Object.<anonymous> (/home/example/path/app.js:33:36)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

The fail happens because repo object loses it's this.dot_git field (because of the deasync invoke) and tries to open a file with path:
this.dot_git + '/HEAD'

More explanations / benchmark ?

Maybe it need more explanations about the event loop and when the "while" loop is fire, for the people (like me) that don't know the libuv API.

I noticed that more there is async call after calling deasync(fn)(), more there is loop in the "while" (I just put a console.log after binding.run() to see it)

So what will append if you do it on an http server for example ?
Finaly, how this reduces the performances ?

Thanks

Trying to use with browserify fails

It appears that this is a "browserifyable" package according to Browserify Search (fig1), but I am struggling to get it to work (fig 2). Could it be that it actually can't be used in the browser? It seems likely because in the description it says it relies on node and the point of failure appears to be on a lookup to a node variable.

Just want to confirm that this is true, and also to recommend to y'all that you make this limitation maybe a bit more visible in the docs.

Thanks!
-Thomas

Fig 1:
image

Fig 2:
image

deasync with node built-in IPC

Given the two scripts:
parent.js:

var cp = require('child_process');

var child = cp.fork(__dirname + '/child.js');
child.on('message', function(msg) {
    console.log('From child: ' + msg);
    if(msg === 'hi') {
        child.send('yay');
        setTimeout(function() {
            console.log('Parent is actully sad ...');
            child.send('sad ...')
        }, 1500);
    }
});

child.js:

var deasync = require('deasync');

var recvCount = 0;
process.on('message', function(msg) {
    console.log('From parent: ' + msg);
    recvCount += 1;
    if(msg === 'yay') {
        while(recvCount < 2) 
            deasync.runLoopOnce();
        console.log('done');
    }
});

process.send('hi');

Here I'm expecting the child recevies all two messages from parent, however all I see is

$ node modules/parent.js
From child: hi
From parent: yay
Parent is actull sad ...

and then it hangs forever.

Am I missing/misusing something, or it's a bug in deasync?

symbol lookup error

When i tty using this code

        while(!result) {
            require('deasync').runLoopOnce();
        }

my app crashed with

symbol lookup error: /home/apache2/zul.dev/www/node_modules/deasync/bin/linux-x64-node-0.11/deasync.node: undefined symbol: _ZN2v86Object3SetENS_6HandleINS_5ValueEEES3_NS_17PropertyAttributeE

Ubuntu 14.04
Node v0.10.33
Linux zx386-nb 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Installing with npm 2.5.1 fails

Using npm 2.5.1, installation of version 0.0.9 fails when executing:

npm install --save-dev deasync

It also fails for the previous versions as well. Here's a snippet of the npm-debug.log. Let me know if you need more information:

238 verbose stack Error: [email protected] install: `node ./build.js`
238 verbose stack Exit status 1
238 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
238 verbose stack     at EventEmitter.emit (events.js:110:17)
238 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:14:12)
238 verbose stack     at ChildProcess.emit (events.js:110:17)
238 verbose stack     at maybeClose (child_process.js:1008:16)
238 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
239 verbose pkgid [email protected]
240 verbose cwd C:\ws\sniads
241 error Windows_NT 6.1.7601
242 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "deasync"
243 error node v0.12.0
244 error npm  v2.5.1
245 error code ELIFECYCLE
246 error [email protected] install: `node ./build.js`
246 error Exit status 1
247 error Failed at the [email protected] install script 'node ./build.js'.
247 error This is most likely a problem with the deasync package,
247 error not with npm itself.

process.exit before it's finished

The code below should run a function and show on the screen twice incallback.

    var i=0
    setInterval(function(){
        i++;
        console.log(i)
        if(i==20) process.exit()
    },100)

    console.log('start')
    require('deasync')(a)()
    console.log('middle')
    require('deasync')(a)()



    function a(callback){
        setTimeout(function(){
            console.log('incallback')
            callback(null)
        },1500)
    }

The is the results:

    start
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    incallback
    middle
    14
    15
    16
    17
    18
    19
    20
    [Finished in 2.3s]

As You can see the a func called only once

Hanging with "process.nextTick"

deasync calls are hanging when calling a Bluebird nodeified function: promise.nodiefy() as seen in the following code sample:

var Promise = require('bluebird');
var deasync = require('deasync');

function foo(cb) {
  return Promise.resolve()
    .then(function () {
      return 'bar';
    })
    .nodeify(cb);
}

// Prints 'bar'. No problem with `bluebird` library.
foo().then(console.log);

// Prints 'bar'. No problem with `bluebird`'s `promise.nodeify()`.
foo(function (err, result) {
  console.log(result);
});

// Hanging at `Promise.resolve()` when used with `deasync`...
console.log(deasync(foo)());

"module.exports.loopUntil" should say "module.exports.loopWhile"

There is an error in index.js line 69, it says

module.exports.loopUntil = function(pred){

when it should say

module.exports.loopWhile = function(pred){

loopWhile is referenced by deasync function (line 44) but is not defined, and loopUntil in fact behaves as loopWhile

process.nextTick issue

I have a library, which is using async methods. I wrapped the async methods into deasync call to call as sync.

When I call methods from function which I wrapped into process.nextTick working well, but if I call method after nextTick the deasync wont return and code execution freeze (I think it wait for response).

Example:

function hello(callback){
  callback(null,'hello');
}

process.nextTick(function(){
  while(true){
    console.log(deasync(hello)()); // print 'hello'
  }
});

console.log(deasync(hello)()) // no result, code freeze here

Problems while not using setTimeout

Hi everyone,
I've been trying this awesome module for quite a long time, but just today figured out that it has some issues if no timer is set (for example the callback comes from a custom function that makes a call to the request() module)

customRequest("GET", "/",
        {}, function(err, res, body)
        {
            var json = JSON.parse(body);
            setTimeout(function(){done = true;}, 1); //workaround
        });
while (!done)
        {
            deasync.runLoopOnce();
        }

I've just figured out that when I don't set a timeout but i set the "done" variable to true the deasync module keeps waiting. Seems like deasync.runLoopOnce() stucks since if I debug the loop by adding a console.log("loop()"); after the done is set to true it keeps waiting, till the done is set by a setTimeout function.

I'm currently using node v.0.12.0

denys@denys-pc:~/$ node -v
v0.12.0

run fail

I'm trying to find a momentary solution to this problem:
jaystack/jaydata#205
using xslt4node (which is asyc) node v0.12, npm v2.5.1, deasync v0.0.10

 deasync(xslt4node.transform)(config)

result:

  Assertion failed: (handle->type == UV_TCP || handle->type == UV_TTY || handle->type ==UV_NAMED_PIPE), function uv___stream_fd, file ../deps/uv/src/unix/stream.c, line 1510.
  Abort trap: 6

jaydata isn't "my code". @abbr answer tell me that deasync isn't the right solution.
As a quick fix (waiting a xslt4node sync version) if I use node v0.12 child_process.execSync I can have a sync behavior that works like a charm in a big project like jay data too.

deasync hangs in an asynchronous context

When using a deasynced function in asynchronous code, deasync hangs and never returns.

var deasync = require('deasync');

function async(cb) {
  setTimeout(function() {
    cb(null, 'value');
  }, 0);
}

function sync() {
  return deasync(async)();
}

console.log('start', sync());
async(function(err, val) {
  console.log('async result', val);
  console.log(sync());
  console.log('done');
});

Notice that when run, the second call to sync hangs. I was originally using promises when testing this and derived the previous code from this:

var Promise = require('q');
var deasync = require('deasync');

function async() {
  return Promise.resolve('value');
}

function sync() {
  var result, done;
  async().then(function(response) {
    result = response;
  }).finally(function() {
    done = true;
  });

  deasync.loopWhile(function() { return !done; });

  return result;
}

console.log('start', sync());
async().then(function(result) {
  console.log('async result', result);
  return sync();
}).then(function(value) {
  console.log(value);
  console.log('done');
});

I also tried the above example using the Bluebird promise library and ended up with the same results. In the promise example, adding a console.log inside the loopWhile handler shows that it is stuck checking done since the promise chain never completes.

Could not locate bindings file

When I'm trying to run project with deasync module, on application start I get:

/opt/website/my-proj/node_modules/deasync/node_modules/bindings/bindings.js:91
  throw err
        ^
Error: Could not locate the bindings file. Tried:
 → /opt/website/my-proj/node_modules/deasync/build/deasync.node
 → /opt/website/my-proj/node_modules/deasync/build/Debug/deasync.node
 → /opt/website/my-proj/node_modules/deasync/build/Release/deasync.node
 → /opt/website/my-proj/node_modules/deasync/out/Debug/deasync.node
 → /opt/website/my-proj/node_modules/deasync/Debug/deasync.node
 → /opt/website/my-proj/node_modules/deasync/out/Release/deasync.node
 → /opt/website/my-proj/node_modules/deasync/Release/deasync.node
 → /opt/website/my-proj/node_modules/deasync/build/default/deasync.node
 → /opt/website/my-proj/node_modules/deasync/compiled/0.11.14/linux/x64/deasync.node
    at bindings (/opt/website/my-proj/node_modules/deasync/node_modules/bindings/bindings.js:88:9)
    at Object.<anonymous> (/opt/website/my-proj/node_modules/deasync/index.js:13:31)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/opt/website/my-proj/db/methods/users.js:10:15)
    at Module._compile (module.js:460:26)

Here's what directory browsing gives me:

$ ls ./node_modules/deasync/
bin  binding.gyp  build.js  index.js  node_modules  package.json  quick-test.js  README.md  src  test.js
$ ls ./node_modules/deasync/bin/
darwin-x64  linux-ia32  linux-x64  win32-ia32  win32-x64

OS version:

$ cat /proc/version 
Linux version 3.8.13-44.el6uek.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #2 SMP Fri Aug 8 21:59:01 PDT 2014

Node version:

$ node --version
v0.11.14

npm version:

$ npm --version
2.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.