nodeplotlib icon indicating copy to clipboard operation
nodeplotlib copied to clipboard

spawn ENOENT error

Open pierreloicq opened this issue 5 years ago • 7 comments

Hi, I put a simple test.js alone in a directory:

plotlib = require('nodeplotlib'); const data = [{x: [1, 3, 4, 5], y: [3, 12, 1, 4], type: 'line'}]; plotlib.plot(data);

then npm install nodeplotlib

npm WARN saveError ENOENT: no such file or directory, open '/home/pierre/testPlotLib/package.json' npm WARN enoent ENOENT: no such file or directory, open '/home/pierre/testPlotLib/package.json'

These lines appear here but not when I install for my project. Then node test.js

(node:5472) UnhandledPromiseRejectionWarning: Error: spawn /home/pierre/testPlotLib/node_modules/nodeplotlib/dist/lib/xdg-open ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19) at onErrorNT (internal/child_process.js:379:16) at process._tickCallback (internal/process/next_tick.js:178:19) at Function.Module.runMain (internal/modules/cjs/loader.js:697:11) at startup (internal/bootstrap/node.js:201:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3) (node:5472) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:5472) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have an apache local server running, but same error when I switch it off. Any idea ? Thanks

pierreloicq avatar Apr 22 '19 08:04 pierreloicq

Hi, @pierreloicq We (with colleagues) faced the same issue (and port-related one as well). For now we suspect it caused by https://github.com/ngfelixl/nodeplotlib/blob/master/src/server.ts#L41

Upd: actually src/server.ts#L69 opn() try to run browser by xdg-open(1) Looks like you either have no X-window (like me) or xdg mis/non-configired.

medved-nsk avatar Apr 22 '19 09:04 medved-nsk

Thanks for your reply, so I guess it's complex to repair myself

pierreloicq avatar Apr 23 '19 05:04 pierreloicq

Thanks for your issue report :) I can not reproduce it myself with 0.6.1. But I guess @medved-nsk already figured it out in this PR #18 using the node env port variable. I will have a look at it today.

ngfelixl avatar Apr 23 '19 08:04 ngfelixl

Just for the record:

  1. Actually #18 didn't solve this issue.
  2. I believe it's not an issue at all but rather an expected behavior see my previous comment

Though it can be turn into a feature request to run provided command (i.e. curl?) instead of xdg-open and thus make it compatible with GUI-less env (docker, ci etc).

medved-nsk avatar Apr 25 '19 15:04 medved-nsk

Thanks for you replies. xeyes & xdg-open 'https://github.com/ngfelixl/nodeplotlib/' work properly in the basic terminal

pierreloicq avatar Apr 29 '19 00:04 pierreloicq

Seems to be a npm problem, I'll investigate it

pierreloicq avatar Apr 29 '19 00:04 pierreloicq

Just to be sure, do you think my warning messages could cause the problem ?

npm install nodeplotlib npm WARN [email protected] requires a peer of marked@^0.3.3 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] No repository field.

  • [email protected] updated 1 package and audited 680 packages in 3.615s found 10 vulnerabilities (1 low, 9 moderate) run npm audit fix to fix them, or npm audit for details

pierreloicq avatar Apr 29 '19 02:04 pierreloicq