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

Error: ENOENT: no such file or directory #12

Open
jeemok opened this issue Dec 12, 2018 · 7 comments
Open

Error: ENOENT: no such file or directory #12

jeemok opened this issue Dec 12, 2018 · 7 comments
Labels
bug Something isn't working

Comments

@jeemok
Copy link

jeemok commented Dec 12, 2018

Thank you for the great package! I was trying to install it and use it on my project but couldn't seemed to get it working. The script and error is posted below. Sorry if I missed out any steps, please let me know!

Package.json

  "scripts": {
    "lint:deps": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-"
   }

Error

to be executed: "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-"
fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'C:\dev\stdin'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at Object.<anonymous> (C:\Users\mok\project\node_modules\audit-filter\cli.js:35:16)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Function.Module.runMain (module.js:676:10)
    at startup (bootstrap_node.js:187:16)
@g-k
Copy link
Contributor

g-k commented Feb 8, 2019

Hey @jeemok sorry for the delay getting back to you! Feel free to @ mention me.

I haven't tested it on Windows. - is an alias for unix stdin and I'm not sure that exists on Windows.

If you don't mind writing the audit output to a file you could try something like:

npm audit --json > npm-audit-output.json
audit-filter --nsp-config=.nsprc --audit=npm-audit-output.json

Let me know if that works for you.

@g-k g-k added the bug Something isn't working label Feb 8, 2019
@g-k
Copy link
Contributor

g-k commented Feb 8, 2019

This is also a bug.

node.js's process.stdin and Rust's io::stdin() https://doc.rust-lang.org/std/io/struct.Stdin.html should be platform aware, but since we're compiling to WASM it ends up using the linux path.

We can fix this with a runtime check either in node or rust.

Compiling separate WASM modules for each platform would work too, but defeats the purpose of using WASM.

@g-k
Copy link
Contributor

g-k commented Feb 8, 2019

We'll also need Windows CI to test this regression (possibly with appveyor).

@g-k
Copy link
Contributor

g-k commented Feb 11, 2019

This is actually hardcoded at

configPath = '/dev/stdin';
so that should be easy to fix.

edit: except there's no clear equivalent on windows hmm

@rakeshramakrishnan
Copy link

Any workaround until the bug is patched?

@g-k
Copy link
Contributor

g-k commented Dec 11, 2019

@rakeshramakrishnan yep write to a tempfile as described in #12 (comment)

@g-k
Copy link
Contributor

g-k commented Dec 11, 2019

The challenge is passing https://nodejs.org/api/process.html#process_process_stdin as https://doc.rust-lang.org/std/io/struct.Stdin.html (or a reference to it) across the wasm boundary and /dev/stdin was a *nix only hack around that.

We'd probably want to check whether wasm-bindgen can do that and otherwise write a binding like this one for console log https://github.com/rustwasm/wasm-bindgen/blob/master/examples/console_log/src/lib.rs

Alternatively, we could write a shim to save to a tempfile on windows, but that seems pretty gross.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants