Skip to content
This repository was archived by the owner on Aug 9, 2021. It is now read-only.

error for Json.parse on line 26 of node2docfx.js #12

Description

@yuan208208

When i execute "node node_modules/node2docfx/node2docfx.js node2docfx.json",
then throw exception:
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse ()

And i found the code on line:26 in node2docfx.js:
config = JSON.parse(fs.readFileSync(configPath));

Maybe it returns buffer array for fs.readFileSync,but "JSON.parse" needs a Json string, so i update the code to:
config = JSON.parse(fs.readFileSync(configPath, 'utf-8').toString().trim());

And it works.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions