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

spawn ENOENT error #17

Open
pierreloicq opened this issue Apr 22, 2019 · 7 comments · Fixed by #18
Open

spawn ENOENT error #17

pierreloicq opened this issue Apr 22, 2019 · 7 comments · Fixed by #18
Labels
bug Something isn't working previous version Belongs to a version < 1.0.0

Comments

@pierreloicq
Copy link

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

@medved-nsk
Copy link
Contributor

medved-nsk commented Apr 22, 2019

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.

@pierreloicq
Copy link
Author

pierreloicq commented Apr 23, 2019

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

@ngfelixl ngfelixl added the bug Something isn't working label Apr 23, 2019
@ngfelixl
Copy link
Owner

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.

@medved-nsk
Copy link
Contributor

Just for the record:

  1. Actually feat: use PORT env variable if provided instead of default (8080) #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).

@pierreloicq
Copy link
Author

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

@pierreloicq
Copy link
Author

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

@pierreloicq
Copy link
Author

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

@ngfelixl ngfelixl reopened this May 2, 2019
@ngfelixl ngfelixl added the previous version Belongs to a version < 1.0.0 label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working previous version Belongs to a version < 1.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants