0

I am using JSDoc 3.4.3 and I'm trying to run config.json file to create documentation for multiple files. However every time I try to run the following command:

jsdoc -c conf.json

I get this error:

Cannot parse the config file conf.json: SyntaxError: Unexpected token : Exiting JSDoc because an error occurred. See the previous log messages for details.

I even tried copying and pasting the example config file found in official JSDoc documentation http://usejsdoc.org/about-configuring-jsdoc.html

"source": {
"include": [ "myProject/a.js", "myProject/lib", "myProject/_private" ],
"exclude": [ "myProject/lib/ignore.js" ],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
}

But that gives the same error.

Any ideas on how to fix the issue? Thanks!

dsvorc41
  • 45
  • 1
  • 7
  • How to fix? Copy the complete object from the "Configuration File" section – Andreas Feb 06 '17 at 16:08
  • Thank you! It works! You should turn your comment into an answer so I can mark it as useful and as a solution to my problem :) – dsvorc41 Feb 06 '17 at 16:43

2 Answers2

0

I had a similar issue. First, I verified that the file was encoded as UTF-8 via Notepad++. When that didn't work, based on the comment from Andreas, I simply copied and pasted my config code into the same file, saved, ran jsdoc -c jsdoc.conf and it worked. Hope this helps someone in the future.

Webreality
  • 623
  • 1
  • 6
  • 11
0

I had this problem when I tried to feed it valid JSON, but in a file with .js extension. Silly mistake, I create a dynamic object and export it into a static json file before running JSDoc and forget to use .json extension for the created file. It gives Cannot parse the config file [...].js: SyntaxError: Unexpected token ':' which is a really bad error message. Hope it helps someone.

Jiří
  • 415
  • 6
  • 16