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
Bug: Long node_modules plugin paths cannot be found on Windows #17763
Comments
I can reproduce this locally. However, it doesn't look like a problem in ESLint, but rather in Node.js, and I'm not sure if there's anything we could do in ESLint to avoid this. The error message says:
ESLint just calls |
Interesting, so maybe the comment by @bzoz that Node.js is not affected by the 260 character path limit on Windows doesn't apply here or is outdated somehow - maybe Node.js has a limitation here... Maybe time to open a Node.js bug. |
I opened a first issue to revisit Microsoft's |
And I also opened an issue in Node.js: |
To echo @mdjermanovic, this is an issue with Node.js rather than with ESLint, so closing. |
These file/folder structures that have long paths are commonly created by pnpm as well - if you're running into "Cannot find file" with ESLint and pnpm on Windows and are looking for a workaround, here's what I'm currently using: This is just a temporary workaround until the Node.js PR fixing long paths on Windows is merged: |
Environment
Node version: 20.9.0
npm version: 10.1.0
Local ESLint version: 8.53.0
Global ESLint version: --
Operating System: Microsoft Windows Server 2022 10.0.20348
What parser are you using?
Default (Espree)
What did you do?
Configuration (Flat Config)
What did you expect to happen?
ESLint should run, also when the paths are deep and long (over 260 character
MAX_PATH
limit on Windows)What actually happened?
ESLint crashes on Windows when the paths are deep and long (over 260 character
MAX_PATH
limit on Windows)The
D:\a\eslint-max_path-windows-bug\eslint-max_path-windows-bug\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\long-path\node_modules\eslint-plugin-import\package.json
path is 277 characters long.Alternatives Considered
I was first thinking this may be a Windows configuration problem or a Node.js path resolution bug, but apparently both of these support 260+ character paths:
Link to Minimal Reproducible Example
https://github.com/karlhorky/eslint-max_path-windows-bug
Participation
Additional comments
This is a contrived example, but this can happen easily in normal projects with tools like
pnpm
, which creates long file paths:The text was updated successfully, but these errors were encountered: