Skip to content

Electron builder fails due to trailing comma in dependency package.json #128

@drclementshimizu

Description

@drclementshimizu

I previously filed this bug with electron builder, but the issue was with app-builder.

Electron-Builder Version:
^24.13.3
Node Version:
10.7.0
Electron Version:
Electron Type (current, beta, nightly):
26.0.0
Target:
windows
Electron builder fails when there is a trailing comma in a package.json.
this is not allowed in json, but many systems are able to overlook it, because javascript allows it.

for example, a NPM dependency of a project's package.json has a trailing comma. and this produces a difficult to interpret error
https://www.npmjs.com/package/Babel

electron-builder

• electron-builder version=24.13.3 os=10.0.22631
• loaded configuration file=package.json ("build" field)
• description is missed in the package.json appPackageFile=MYAPP\package.json
• writing effective config file=dist\builder-effective-config.yaml
⨯ node_modules.Dependency.ReadString: expects " or n, but found }, error found in electron-userland/electron-builder#10 byte of ...|.x"
},
}|..., bigger context ...| "step": "0.0.x",
"underscore": "1.x.x"
},
}|...
Error reading package.json: MYAPP\node_modules\Babel\package.json

I was able to fix my error by ensuring the node_modules\Babel\package.json has no trailing commas

However, just a request to make that work without having to police my dependencies...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions