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)
import eslintImport from 'eslint-plugin-import';
const config = [
{
plugins: {
import: eslintImport,
},
rules: {
'no-unused-vars': 'warn',
},
},
];
export default 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)
$ npm install
$ npx eslint . # In root, working
D:\a\eslint-max_path-windows-bug\eslint-max_path-windows-bug\index.js
Warning: 1:7 warning 'a' is assigned a value but never used no-unused-vars
$ mkdir 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\
$ cp eslint.config.js 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\
$ cp index.js 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\
$ cp package.json 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\
$ cd 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\
$ npm install
$ npx eslint .
Oops! Something went wrong! :(
ESLint: 8.53.0
Error: Cannot find package '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' imported from 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\eslint.config.js
Did you mean to import eslint-plugin-import/lib/index.js?
at legacyMainResolve (node:internal/modules/esm/resolve:189:26)
at packageResolve (node:internal/modules/esm/resolve:[7](https://github.com/karlhorky/eslint-max_path-windows-bug/actions/runs/6876786397/job/18703094495#step:9:8)76:14)
at moduleResolve (node:internal/modules/esm/resolve:[8](https://github.com/karlhorky/eslint-max_path-windows-bug/actions/runs/6876786397/job/18703094495#step:9:9)38:20)
at defaultResolve (node:internal/modules/esm/resolve:1043:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:228:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:3[9](https://github.com/karlhorky/eslint-max_path-windows-bug/actions/runs/6876786397/job/18703094495#step:9:10))
at link (node:internal/modules/esm/module_job:84:36)
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:
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_PATHlimit on Windows)What actually happened?
ESLint crashes on Windows when the paths are deep and long (over 260 character
MAX_PATHlimit 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.jsonpath 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: