question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle non-existent NODE_PATH directory in Files.resolve

See original GitHub issue

If nodePath refers to a non-existent directory, the following occurs:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\{user}\AppData\Local\Programs\Microsoft VS Code\Code.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19)
    at onErrorNT (internal/child_process.js:406:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
    at onErrorNT (internal/child_process.js:406:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

@egamma handled this in the deprecated vscode-tslint extension with this change, and I followed suit in my extension.

However, since fs.exists is deprecated, and existence checks in general are not recommended, I was wondering if it was possible for this to be handled by vscode-languageserver-node instead?

I see that you’re using on('error') in addition to a try/catch block – is this just a bug in Electron or Node.js? If so, is there an issue tracking it?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Apr 24, 2019

@glen-84 please ping if you have any additional info.

1reaction
dbaeumercommented, Apr 10, 2019

I will keep it open and see if you find something out. May be we can improve the behaviour in the library as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
require.resolve with paths and non-existent directory returns incorrect ... Execute the test.js file with node test.js on v9.3.0 or later.
Read more >
specify whether or not a file exists in node.js - Stack Overflow
I'd suggest looking at this console.log(path.resolve('../../upload/images/book/2.jpg')) and see exactly what ...
Read more >
How To Use __dirname in Node.js - DigitalOcean
__dirname is an environment variable that tells you the absolute path of the directory containing the currently executing file.
Read more >
Node.js — Check If a Path or File Exists - Future Studio
When interacting with the file system, you may want to check whether a file exists on the hard disk at a given path....
Read more >
How YOU can learn Node.js I/O, files and paths
Working with file paths, it's important when working with files and directories that we understand how to work with paths.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found