Handle non-existent NODE_PATH directory in Files.resolve
See original GitHub issueIf 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:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@glen-84 please ping if you have any additional info.
I will keep it open and see if you find something out. May be we can improve the behaviour in the library as well.