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

Cannot read header file #1107

Closed
eidoil32 opened this issue Dec 1, 2021 · 8 comments
Closed

Cannot read header file #1107

eidoil32 opened this issue Dec 1, 2021 · 8 comments
Assignees
Labels
bug fixed on dev for issues fixed on dev branch windows

Comments

@eidoil32
Copy link

eidoil32 commented Dec 1, 2021

Hi,
We facing new error after upgrading to latest version.

Error

debug: Now looking for apidoc config files
debug: Now looking for package.json
debug: Now looking for apidoc.json
debug: Found file: path\to\apidoc.json
debug: Now looking for apidoc.config.js
debug: Now looking for header
debug: Found file: path\to\header.md
debug: Reading header file: header.md
error: Can not read: header.md
debug: Error: Can not read: header.md
  • I censored the path to files

Steps to reproduce

We added header.md file in config file for example

  "header": {
    "filename" : "header.md"
  }

The header.md file locate on the root folder of the apidoc\input
Seems that you trying to looking the header in the wrong path.
Maybe on this part of the code: https://github.com/apidoc/apidoc/compare/0.50.1...0.50.2#diff-e940db824fd38ce6d7405b4c6c09dda96482eb01cc7b1f453b24235795b85a2c

Information

  • Version of apidoc: 0.50.2
  • Operating system: Windows
  • Node version: 6.14.10
  • Browser (e.g. firefox, chrome): not relevant
@NicolasCARPi
Copy link
Collaborator

NicolasCARPi commented Dec 1, 2021

Can you modify this line: https://github.com/apidoc/apidoc/blob/master/lib/reader.js#L89

and replace './' with '.' + this.path.sep?

@viames
Copy link

viames commented Dec 3, 2021

Can you modify this line: https://github.com/apidoc/apidoc/blob/master/lib/reader.js#L89

and replace './' with '.' + this.path.sep?

Unfortunately this tip does not solve the problem. Version 0.50.1 does not have this problem and works well with my documentation designed for apidoc-0.29.

@NicolasCARPi NicolasCARPi self-assigned this Dec 3, 2021
@holopekochan
Copy link

holopekochan commented Dec 14, 2021

I also have the same problem with newest version in Ubuntu, cannot read header.md

@devenami
Copy link

yes, i also got this error if i use apidoc -i input -o output.
you can avoid this error by cd input && apidoc -i . -o output

@NicolasCARPi
Copy link
Collaborator

I'm having a hard time reproducing this issue. Can anyone try and provide a reproducible minimal case? Give as much information a possible, with relevant debug lines. Where is the command launched from, where are the files, what's in your config, etc...

@gmkou
Copy link

gmkou commented Dec 22, 2021

@NicolasCARPi I have same issue and here is minimum case.
https://github.com/gmkou/apidoc-1107

-> % apidoc --version
0.50.1

-> % apidoc -i ./annotation/hoge -o ./docs/hoge/api/

-> % npm install -g apidoc@0.50.2

added 10 packages, changed 292 packages, and audited 303 packages in 10s

35 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

-> % apidoc -i ./annotation/hoge -o ./docs/hoge/api/

error: Can not read: header.md
[error] apidoc encountered an error during documentation generation!

-> % apidoc -i ./annotation/hoge -o ./docs/hoge/api/ --debug
[debug] Parsed options:

{
  excludeFilters: [ 'apidoc.config.js', 'node_modules' ],
  includeFilters: [
    '.*\\.(clj|cls|coffee|cpp|cs|dart|erl|exs?|go|groovy|ino?|java|js|jsx|kt|litcoffee|lua|mjs|p|php?|pl|pm|py|rb|scala|ts|vue)$'
  ],
  src: [ './annotation/hoge' ],
  dest: './docs/hoge/api/',
  template: '/Users/USERNAME/.npm-global/lib/node_modules/apidoc/template/',
  config: '',
  apiprivate: false,
  verbose: false,
  single: false,
  debug: true,
  colorize: true,
  filters: {},
  languages: {},
  parsers: {},
  workers: {},
  silent: false,
  dryRun: false,
  markdown: true,
  lineEnding: '\n',
  encoding: 'utf8',
  copyDefinitions: true,
  filterBy: '',
  logFormat: 'simple',
  warnError: false
}
debug: Now looking for apidoc config files
debug: Now looking for package.json
debug: Now looking for apidoc.json
debug: Found file: /Users/USERNAME/DIR/DIR/apidoc-1107/annotation/hoge/apidoc.json
debug: Now looking for apidoc.config.js
debug: Now looking for header
debug: Found file: annotation/hoge/header.md
debug: Reading header file: header.md
error: Can not read: header.md
debug: Error: Can not read: header.md
    at /Users/USERNAME/.npm-global/lib/node_modules/apidoc/lib/reader.js:110:17
    at Array.forEach (<anonymous>)
    at Reader.getHeaderFooter (/Users/USERNAME/.npm-global/lib/node_modules/apidoc/lib/reader.js:85:26)
    at Reader.read (/Users/USERNAME/.npm-global/lib/node_modules/apidoc/lib/reader.js:42:39)
    at Object.createDoc (/Users/USERNAME/.npm-global/lib/node_modules/apidoc/lib/index.js:77:33)
    at Object.<anonymous> (/Users/USERNAME/.npm-global/lib/node_modules/apidoc/bin/apidoc:170:12)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[error] apidoc encountered an error during documentation generation!

-> % 

NOTE: Using MacBook.

@NicolasCARPi NicolasCARPi added the fixed on dev for issues fixed on dev branch label Dec 23, 2021
@NicolasCARPi
Copy link
Collaborator

Hello @gmkou and thank you for providing a reproducible repo, it helps a lot if a bug can be reproduced.

Could you please try the latest code for the dev branch and let me know if the issue is fixed? Also note that specifying the path to the config file with the -i flag solves this bug in the current stable release.

@gmkou
Copy link

gmkou commented Dec 24, 2021

Hi @NicolasCARPi
The issue has solved with the latest code for the dev branch ! Thank you! :)
And also soled with -c flag on stable release.

-> % apidoc -i ./annotation/hoge -o ./docs/hoge/api/
error: Can not read: header.md
[error] apidoc encountered an error during documentation generation!
-> % apidoc -c ./annotation/hoge/apidoc.json -i ./annotation/hoge -o ./docs/hoge/api/
-> % 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed on dev for issues fixed on dev branch windows
Projects
None yet
Development

No branches or pull requests

6 participants