marcj/typedoc-plugin-lerna-packages

Illegal Operation on a directory, read

baswag opened this issue · 2 comments

When trying to run typedoc with the plugin installed, the docs cannot be generated and the command fails with the following trace:

> yarn typedoc .
yarn run v1.22.4
$ C:\PATH\node_modules\.bin\typedoc .
Loaded plugin C:\PATH\node_modules\typedoc-neo-theme
Loaded plugin C:\PATH\node_modules\typedoc-plugin-lerna-packages

Using TypeScript 3.7.5 from C:\PATH\node_modules\typedoc\node_modules\typescript\lib
Lerna packages found {
  '@scope/one': 'packages/one',
  '@scope/two': 'packages/two',
  '@scope/three': 'packages/three',
  '@scope/four': 'packages/four',
  '@scope/five': 'packages/five',
  '@scope/six': 'packages/six',
  '@scope/seven': 'packages/seven'
}
internal/fs/utils.js:230
    throw err;
    ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:564:3)
    at tryReadSync (fs.js:349:20)
    at Object.readFileSync (fs.js:386:19)
    at LernaPackagesPlugin.onBeginResolve (C:\PATH\node_modules\typedoc-plugin-lerna-packages\dist\plugin.js:102:39)
    at triggerEvents (C:\PATH\node_modules\typedoc\dist\lib\utils\events.js:128:43)
    at triggerApi (C:\PATH\node_modules\typedoc\dist\lib\utils\events.js:110:13)
    at eventsApi (C:\PATH\node_modules\typedoc\dist\lib\utils\events.js:21:18)
    at Converter.trigger (C:\PATH\node_modules\typedoc\dist\lib\utils\events.js:264:13)
    at Converter.resolve (C:\PATH\node_modules\typedoc\dist\lib\converter\converter.js:180:14)
    at Converter.convert (C:\PATH\node_modules\typedoc\dist\lib\converter\converter.js:91:30) {
  errno: -4068,
  syscall: 'read',
  code: 'EISDIR'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried uninstalling the neo theme and using typedoc 0.16 and 0.17, to no avail

Typedoc Version:

> yarn typedoc --version
yarn run v1.22.4
$ C:\PATH\node_modules\.bin\typedoc --version
Loaded plugin C:\PATH\node_modules\typedoc-plugin-lerna-packages

TypeDoc 0.16.11
Using TypeScript 3.7.5 from C:\path\node_modules\typedoc\node_modules\typescript\lib
Done in 3.17s.

Node Version:

> node --version
v12.18.2

typedoc.json:

{
  "name": "NAME",
  "mode": "modules",
  "out": "docs",
  "ignoreCompilerErrors": "false",
  "preserveConstEnums": "true",
  "exclude": ["**/node_modules/**", "*.spec.ts"],
  "stripInternal": "false"
}

Also tried with a typedoc.js instead but this didn't change anything

Found the issue:
When the readme option is not set in the typedoc config, this.readme in plugin.ts is set to '' leading for the check to be truthy (as it is transpiled into to (_a = this.readme) !== null && _a !== void 0 ? _a : 'README.md')).
Therefore, the readMePath is now the fullPath.
As this directory exists and this.readme is not 'none', it tries to read the directory leading to the error.
A quick fix until this is fixed is to set the readme option in the typedoc options.

marcj commented

Good find! Do you want to provide a PR with a fix? :)