tajo / ladle

🥄 Develop, test and document your React story components faster.
https://www.ladle.dev
MIT License
2.63k stars 93 forks source link

Error: ENOENT: no such file or directory, open 'node_modules\@ladle\react\typings-for-build\app\.gitignore' #431

Closed hayk94 closed 1 year ago

hayk94 commented 1 year ago

Describe the bug

Get the following error in the terminal after running yarn run ladle

PS C:\Users\hs\Projects\MY_PROJECT> yarn ladle serve
yarn run v1.22.19
$ C:\Users\hs\Projects\MY_PROJECT\node_modules\.bin\ladle serve

node:internal/event_target:1010
  process.nextTick(() => { throw err; });
                           ^
Error: Cannot read .eslintignore file: C:\Users\hs\Projects\MY_PROJECT\node_modules\@ladle\react\typings-for-build\app\.gitignore
Error: ENOENT: no such file or directory, open 'C:\Users\hs\Projects\MY_PROJECT\node_modules\@ladle\react\typings-for-build\app\.gitignore'
    at Object.openSync (node:fs:600:3)
    at Object.readFileSync (node:fs:468:35)
    at readFile (C:\Users\hs\Projects\MY_PROJECT\node_modules\@eslint\eslintrc\lib\config-array-factory.js:142:15)
    at loadESLintIgnoreFile (C:\Users\hs\Projects\MY_PROJECT\node_modules\@eslint\eslintrc\lib\config-array-factory.js:270:16)
    at ConfigArrayFactory.loadESLintIgnore (C:\Users\hs\Projects\MY_PROJECT\node_modules\@eslint\eslintrc\lib\config-array-factory.js:559:32)
    at createCLIConfigArray (C:\Users\hs\Projects\MY_PROJECT\node_modules\@eslint\eslintrc\lib\cascading-config-array-factory.js:165:34)
    at new CascadingConfigArrayFactory (C:\Users\hs\Projects\MY_PROJECT\node_modules\@eslint\eslintrc\lib\cascading-config-array-factory.js:243:29)
    at new CLIEngine (C:\Users\hs\Projects\MY_PROJECT\node_modules\eslint\lib\cli-engine\cli-engine.js:569:36)
    at new ESLint (C:\Users\hs\Projects\MY_PROJECT\node_modules\eslint\lib\eslint\eslint.js:432:27)
    at Object.configureServer (C:\Users\hs\Projects\MY_PROJECT\node_modules\vite-plugin-checker\dist\cjs\checkers\eslint\main.js:79:22)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:290:10)
    at [kOnMessage] (node:internal/worker:301:37)
    at MessagePort.<anonymous> (node:internal/worker:202:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
    at [kOnExit] (node:internal/worker:268:5)
    at Worker.<computed>.onexit (node:internal/worker:199:20) {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: 'C:\\Users\\hs\\Projects\\MY_PROJECT\\node_modules\\@ladle\\react\\typings-for-build\\app\\.gitignore'
}

Node.js v18.14.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction Here is a stackblitz with the issue reproduced. https://stackblitz.com/edit/ladle-zlqp1g?file=.eslintrc.json

Seems to happen because of custom eslint/vite config?

A workaround for this is just to add a .gitignore file to the @ladle\react\typings-for-build\app\.gitignore directory.

Environment Google Chrome | 112.0.5615.138 (Official Build) (64-bit) (cohort: Stable) OS | Windows 10 Version 22H2 (Build 19045.2846)

tajo commented 1 year ago

Seems to be caused by vite-plugin-checker, not really having bandwidth to debug somewhat atypical typescript setups.