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

File exists, but ENOENT: no such file or directory... reported. #1229

Open
ruffin-- opened this issue Mar 31, 2021 · 23 comments
Open

File exists, but ENOENT: no such file or directory... reported. #1229

ruffin-- opened this issue Mar 31, 2021 · 23 comments
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@ruffin--
Copy link

ruffin-- commented Mar 31, 2021

I'm receiving the following error for some, but not most, files in my project.

(node:26484) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, realpath 'C:\workspaces\WebProduct\Features\MF-QBvN2\Source\Instructor\QuestionBuilder\QuestionBuilder.Web\Scripts\QuestionBuilder\Bank\Models\composite-permissions.service.js'
    at Function.realpathSync.native (fs.js:1684:3)
    at Function.native (electron/js2c/asar_bundle.js:5:4556)
    at c:\Users\usernam\.vscode\extensions\dbaeumer.vscode-eslint-2.1.19\server\out\eslintServer.js:1:14128
    at I (c:\Users\usernam\.vscode\extensions\dbaeumer.vscode-eslint-2.1.19\server\out\eslintServer.js:1:14188)
    at c:\Users\usernam\.vscode\extensions\dbaeumer.vscode-eslint-2.1.19\server\out\eslintServer.js:1:16188
(node:26484) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 290)

Note that failure is silent. I have to open the Output tab to see that anything's wrong. I would not have known except that I noticed issues eslint should have caught.

(Actual user name in paths changed to protect the innocent.)


Files with this error (not necessarily exhaustive, but all I can find atm):

C:\workspaces\WebProduct\Features\MF-QBvN2\Source\Instructor\QuestionBuilder\QuestionBuilder.Web\Scripts\QuestionBuilder\Bank\Models\cache.service.js
C:\workspaces\WebProduct\Features\MF-QBvN2\Source\Instructor\QuestionBuilder\QuestionBuilder.Web\Scripts\QuestionBuilder\Bank\Models\composite-permissions.service.js

Works from the same parent folder:

C:\workspaces\WebProduct\Features\MF-QBvN2\Source\Instructor\QuestionBuilder\QuestionBuilder.Web\Scripts\QuestionBuilder\Bank\Models\folder-store.service.js
C:\workspaces\WebProduct\Features\MF-QBvN2\Source\Instructor\QuestionBuilder\QuestionBuilder.Web\Scripts\QuestionBuilder\Bank\Models\folder.js

The "no such file or directory" makes me suspect it's not the contents of the files that's the issue, which is why I'm giving paths here.

But additionally note that If I move a file that won't lint to, eg, c:\temp\composite-permissions.service.js, it lints as expected. Another piece of evidence that it's not content?

If I execute eslint C:\workspaces\WebProduct\Features\MF-QBvN2\Source\Instructor\QuestionBuilder\QuestionBuilder.Web\Scripts\QuestionBuilder\Bank\Models\composite-permissions.service.js from a command prompt in the C:\Users\usernam directory, the file lints as expected.

Is there a limit to the characters in a file path specific to the extension? Anything else I can send?

@dbaeumer
Copy link
Member

dbaeumer commented Apr 1, 2021

@ruffin-- a workaround is to specify your installed node version as the runtime using the eslint.runtime setting. But please note that you need to confirm the setting using the Command ESLint: Select Node Runtime.

Let me know if that helps.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Apr 1, 2021
@ruffin--
Copy link
Author

ruffin-- commented Apr 1, 2021

I'll give that a shot today.

Update: Gave it a shot. Yep, adding "eslint.runtime": "C:\\Program Files\\nodejs\\eslint", to my settings.json seems to have fixed it. I'll have to remember this if I move to nvm.

Out of curiosity, what's causing it to blow up? The paths of things that work seem as long or longer than some that fail. Is it b/c they start with c? (I'm joking. I think. ;^D)

@ruffin--
Copy link
Author

ruffin-- commented Apr 2, 2021

VS Code updated to v1.55.0 and now I'm receiving

image

Output says...

[Info  - 1:08:59 PM] ESLint server is starting
[Info  - 1:08:59 PM] ESLint server stopped.
[Error - 1:08:59 PM] Starting client failed
Launching server using runtime C:\Program Files\nodejs\eslint failed.

I no longer receive the above error after removing eslint.runtime from settings.

That is, I'm not 100% confident this is a sure fix. I'm in another project now; will try with the one that was giving the original errors when I return.

image

@dbaeumer
Copy link
Member

dbaeumer commented Apr 6, 2021

@ruffin-- you need to set the runtime setting to a node executable (e.g. node.exe). In addition you need to confirm.

The reason why this will address the issue is that it looks like you are using JS constructs which aren't support in the node runtime VS Code ships.

@Niaro
Copy link

Niaro commented Apr 26, 2021

@dbaeumer I'm experiencing the same issue, changing node runtime doesn't help; tried 14, 15, 16.
I see this happening on very long file paths, 250-255

[Info - 12:29:52 AM] ESLint server is starting
[Info - 12:29:52 AM] ESLint server running in node v16.0.0
[Info - 12:29:52 AM] ESLint server is running.
Uncaught exception received.
Error: ENOENT: no such file or directory, realpath 'C:\Development\cashier\libs\merchant-admin\sections\payment-routes\src\lib\sub-modules\payment-options\pages\psp-payment-option-page\pages\psp-payment-option-details-page\components\psp-payment-option-settings-edit-form\psp-payment-option-settings-edit-form.component.ts'
at Function.realpathSync.native (node:fs:1883:3)
at c:\Users\niaro.vscode\extensions\dbaeumer.vscode-eslint-2.1.20\server\out\eslintServer.js:1:15119
at K (c:\Users\niaro.vscode\extensions\dbaeumer.vscode-eslint-2.1.20\server\out\eslintServer.js:1:15179)
at c:\Users\niaro.vscode\extensions\dbaeumer.vscode-eslint-2.1.20\server\out\eslintServer.js:1:17187
Uncaught exception received.

@dbaeumer
Copy link
Member

dbaeumer commented Apr 27, 2021

@Niaro this could be the old Windows path limitation of 256 characters. Your path is 271 characters long. Need to see if this is a problem with realpath.

@Niaro
Copy link

Niaro commented Apr 27, 2021

@Niaro this could be the old Windows path limitation of 256 characters.

That was my assumption too, I changed the registry setting to support long paths and nothing has changed. Although I didn't restart the machine... Could be it

@dbaeumer
Copy link
Member

I am actually not very familiar with the workaround of the long path name issues in Windows.

@HomyeeKing
Copy link

image

select node version failed

and why the eslint disappear from the vscode status bar

@dbaeumer dbaeumer added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Oct 1, 2021
@dbaeumer dbaeumer added this to the Backlog milestone Oct 8, 2021
@doomchild
Copy link

doomchild commented Nov 4, 2021

I get this error when I create a new file. To fix it I have to restart the LSP workspace. Closing and re-opening the file doesn't fix it.

@luis-cosillo
Copy link

I have the same problem, someone knows how to solve it, at the moment the solution is to upload that component a subfolder before, and there it reads, but when many subfolders eslint does not support it.

(node:24172) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, realpath 'G:\proyectos\deerview\frontendsegurosuni\src\app\universal\area-tecnica\configuracion-producto\components\productos\descuento\editar-descuento\descuento-usuario\editar-descuento-usuario\modal-plan-usuario\editar-modal-plan-usuario\editar-modal-plan-usuario.component.html'
    at Function.realpathSync.native (fs.js:1787:3)
    at Function.native (electron/js2c/asar_bundle.js:5:4607)
    at c:\Users\Luis O. Gonzalez\.vscode\extensions\dbaeumer.vscode-eslint-2.2.2\server\out\eslintServer.js:1:171219
    at X (c:\Users\Luis O. Gonzalez\.vscode\extensions\dbaeumer.vscode-eslint-2.2.2\server\out\eslintServer.js:1:171279)
    at c:\Users\Luis O. Gonzalez\.vscode\extensions\dbaeumer.vscode-eslint-2.2.2\server\out\eslintServer.js:1:174350
(node:24172) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 36)

@thomaswdean
Copy link

I am also seeing this issue on a Windows machine with the registry setting to allow for long file paths turned on. No visible errors but files with a path over 256 are not showing the linter errors.

@luis-cosillo
Copy link

@thomaswdean I had to move the files because I did not find suddenly someone has managed to solve it

@thomaswdean
Copy link

@luis-cosillo Thank you. I am considering doing the same. I just wanted to post here to see if anything is being done to address this issue.

@luis-cosillo
Copy link

@thomaswdean Yes, I still hope to have it because it may be later on, depending on the project, but hopefully they will fix it.

@elvinagam
Copy link

I do not think this has been fixed yet... Same issue

@luis-cosillo
Copy link

Follow the only solution is to rename files

@elvinagam
Copy link

elvinagam commented Jul 27, 2022

This is an actual issue which might be hard to fix.
Say I have a filename which should be AppleandPeach.jpg
This "feature" of VSCode makes the filename as appleandpeach.jpg. Say, u have 1 million images like that. How will u programmatically capitalize the capital letter in the second word? No way.

@ZerdoX-x
Copy link

For me error looks like this:

Error: ENOENT: no such file or directory, realpath '/Users/username/path/src/lib/ui/dialog/index.ts'
    at realpathSync.native (node:fs:2554:3)
    at Function.native (node:electron/js2c/asar_bundle:5:4831)
    at t.getFileSystemPath (/Users/username/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:33280)
    at b (/Users/username/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:206750)
    at /Users/username/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:19353
    at async /Users/username/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:210071

This file existed in different branch.
Workaround: delete repo where issue appears, create new folder with new path, clone repo.
I've tried to clean cache, vscode history and other things too.. Nothing except this helps.
Maybe vscode-eslint uses some cache under the hood that may be outdated or something..

@tryonelove
Copy link

tryonelove commented Mar 14, 2023

Same issue here (Windows 11), occurs when filepath length is greater than Windows MAX_PATH length, even though long paths are enabled both in policies and registry. In my case, filepath length is 302.

Manually using eslint --fix <FILEPATH> works just fine.

Looking forward for a fix.

Log:

Uncaught exception received.
Error: ENOENT: no such file or directory, realpath 'LONG_COMPONENT_PATH_THAT_IS_PRIVATE'
    at Function.realpathSync.native (node:fs:2554:3)
    at Function.native (node:electron/js2c/asar_bundle:5:4831)
    at t.getFileSystemPath (c:\Users\Ilya\.vscode\extensions\dbaeumer.vscode-eslint-2.4.0\server\out\eslintServer.js:1:34203)
    at b (c:\Users\Ilya\.vscode\extensions\dbaeumer.vscode-eslint-2.4.0\server\out\eslintServer.js:1:217463)
    at c:\Users\Ilya\.vscode\extensions\dbaeumer.vscode-eslint-2.4.0\server\out\eslintServer.js:1:19757
Uncaught exception received.
Error: ENOENT: no such file or directory, realpath 'LONG_COMPONENT_PATH_THAT_IS_PRIVATE'
    at Function.realpathSync.native (node:fs:2554:3)
    at Function.native (node:electron/js2c/asar_bundle:5:4831)
    at t.getFileSystemPath (c:\Users\Ilya\.vscode\extensions\dbaeumer.vscode-eslint-2.4.0\server\out\eslintServer.js:1:34203)
    at b (c:\Users\Ilya\.vscode\extensions\dbaeumer.vscode-eslint-2.4.0\server\out\eslintServer.js:1:217463)
    at c:\Users\Ilya\.vscode\extensions\dbaeumer.vscode-eslint-2.4.0\server\out\eslintServer.js:1:19757

UPD: Seems like it's Windows issue rather than plugin.

@luis-cosillo
Copy link

They still haven't fixed it, I think we will die without a solution

@tryonelove
Copy link

tryonelove commented Mar 28, 2023

I've done some research and probably it's related to a node version VS Code is using.

My VS Code setup:
Version: 1.76.2 (user setup)
Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884
Date: 2023-03-14T17:55:54.936Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.22621
Sandboxed: No

There was an issue (nodejs/node#44536) with fs.realpathSync.native that was fixed in Node v16.18.0 & 18.10. As we can above, in the VS Code versions, it uses Node v.16.14.2.

Sadly, we cannot do anything until VS Code starts using a newer version of Node.

@dbaeumer
Copy link
Member

@tryonelove actually you can. You can use eslint.runtime setting to point to a different node version used to run the ESLint server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

10 participants