Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function #20

Closed
wnmills3 opened this issue Nov 7, 2018 · 15 comments
Closed

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function #20

wnmills3 opened this issue Nov 7, 2018 · 15 comments
Assignees

Comments

@wnmills3
Copy link

wnmills3 commented Nov 7, 2018

BLUF: it appears the eyeserver can not spawn eye and there is only the /opt/eye/bin/eye.sh and no eye executable that I can find (there is the /opt/eye/lib/eye.pvm though)

I have followed the installation instructions here:
http://eulersharp.sourceforge.net/README.MacOSX
to install eye correctly (see version displayed below for eye, swipl, carl, cturtle, node, and npm)
but when I run: eyeserver 8000 I get this error:

wnm3MacBook:bin wnm3$ eyeserver 8000
events.js:167
throw er; // Unhandled 'error' event
^

Error: spawn eye ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
at process.internalTickCallback (internal/process/next_tick.js:72:19)

wnm3MacBook:bin wnm3$ /opt/eye/bin/eye.sh --version
eye --version
EYE v18.1105.2012 josd
SWI-Prolog 7.6.4 (x86_64-darwin15.6.0): Jan 12 2018, 14:07:02
starting 26 [msec cputime] 46 [msec walltime]
wnm3MacBook:bin wnm3$ swipl --version
SWI-Prolog version 7.6.4 for x86_64-darwin15.6.0
wnm3MacBook:bin wnm3$ carl --version
carl version 1.0.3

Usage: carl [-b=base-uri] [-o=output-file] [input-files]
wnm3MacBook:bin wnm3$ cturtle --version
cturtle version 1.0.6-SNAPSHOT

Usage: cturtle [-b=base-uri] [-o=output-file] [-f=(nt|n3p|n3p-rdiv)] [input-files]

wnm3MacBook:bin wnm3$ node -v
v11.0.0
wnm3MacBook:bin wnm3$ npm -v
6.4.1

I am running XQuartz.app v2.7.11 and logged out/in before attempting to run the eyeserver.

Running as sudo doesn't have any effect to resolve the problem.

@wnmills3

This comment has been minimized.

@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

Based on #8 I have also added /opt/eye/bin to $PATH and I've created the symbolic link from eye to eye.sh in the /opt/eye/bin directory. This has changed the error to:

wnm3MacBook:bin wnm3$ eyeserver 8000
fs.js:144
throw new ERR_INVALID_CALLBACK();
^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:144:11)
at Object.unlink (fs.js:954:14)
at F.release (/Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/node_modules/resourcecache/lib/resourcecache.js:176:8)
at /Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/lib/eye.js:182:30
at Array.forEach ()
at eyeFinished (/Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/lib/eye.js:181:19)
at Socket. (/Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/lib/eye.js:162:9)
at Object.onceWrapper (events.js:273:13)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)

@RubenVerborgh RubenVerborgh changed the title eyeserver 8000 events.js:167 Error: spawn eye ENOENT MacOS 10.14.1 TypeError [ERR_INVALID_CALLBACK]: Callback must be a function Nov 7, 2018
@RubenVerborgh
Copy link
Collaborator

Note that Node 11 is unstable (as are all uneven versions); can you test on 10?

@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

sure, will try to get that set up, thx

@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

Almost the same issue: the line in fs.js changed to 137 from 144...

wnm3MacBook:graceful-fs wnm3$ node -v
v10.13.0
wnm3MacBook:graceful-fs wnm3$ eyeserver 8000
fs.js:137
throw new ERR_INVALID_CALLBACK();
^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at makeCallback (fs.js:137:11)
at Object.unlink (fs.js:936:14)
at F.release (/Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/node_modules/resourcecache/lib/resourcecache.js:176:8)
at /Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/lib/eye.js:182:30
at Array.forEach ()
at eyeFinished (/Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/lib/eye.js:181:19)
at Socket. (/Users/wnm3/.nvm/versions/node/v8.9.1/lib/node_modules/eyeserver/lib/eye.js:162:9)
at Object.onceWrapper (events.js:273:13)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)

@RubenVerborgh
Copy link
Collaborator

Thanks, will investigate.

@RubenVerborgh RubenVerborgh self-assigned this Nov 7, 2018
@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

It must be late for you -- it can wait until tomorrow or when you have time. Thank you.

Note: I installed using the eye.zip:
-rw-r--r--@ 1 wnm3 staff 70475 Nov 7 15:34 eye.zip

If desired I could reinstall by cloning the repo...

@RubenVerborgh
Copy link
Collaborator

Ah well, nothing like a good bug in the evening 🙂

@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

Is it possible that when eye.js calls to remove the temporary file it doesn't pass a callback so it is null in the resourcecache.js? the console.log I added shows callback is undefined:

release: function (fileName, callback) {
console.log("callback: "+callback+" fileNames: "+JSON.stringify(this.fileNames)+" for fileName: "+fileName);
delete this.fileNames[fileName];
fs.unlink(fileName, callback);
},

and the call in eye.js only passes the resource without any callback...
resources.forEach(function (resource) {
console.log("resource: "+resource);
self.resourceCache.release(resource);
});

@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

the console.logs above print:
resource: /tmp/node_74446_0/0.tmp
callback: undefined fileNames: ["/tmp/node_74446_0/0.tmp"] for fileName: /tmp/node_74446_0/0.tmp

@RubenVerborgh
Copy link
Collaborator

Is it possible that when eye.js calls to remove the temporary file it doesn't pass a callback so it is null in the resourcecache.js?

Yes, that was it. Earlier versions of Node didn't require that (this lib is 7 years old).

@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

I believe the tmp file is getting unlinked so perhaps (kludge...) surround by try/catch ;^)

@RubenVerborgh
Copy link
Collaborator

Should be fixed in v1.1.2.

@wnmills3
Copy link
Author

wnmills3 commented Nov 7, 2018

thx, I'm running with the kludge for now:
try {
fs.unlink(fileName, callback);
} catch (e) {}

EYE server running on http://localhost:8000

@RubenVerborgh
Copy link
Collaborator

Why the kludge though? v1.1.2 works fine here on Node v10. Also very unlikely that the kludge will work given that try/catch is sync, but unlink is async.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants