Skip to main content

npm install error

Symptom​

The build fails with the following error:

SyntaxError: Unexpected token in JSON at position 0

Solution​

In gulpfile.ts, change:

var docfxSettings = JSON.parse(fs.readFileSync('./docfx.json'));

to

import * as docfxSettings from './docfx.json';

Next, add tsconfig.json at root:

{
"compilerOptions": {
"module": "commonjs",
"target": "esnext",
"resolveJsonModule": true
}
}