Skip to content

Improve error reporting for invalid package.json syntax #2664

Description

@adamaveray

Description

If the current directory's package.json contains a JSON syntax error, Vite+ outputs an unclear, unhelpful error message e.g. error: Failed to download Node.js runtime: expected value at line 1 column 1. It is not immediately clear that the issue is due to a syntax error in the package.json file.

Suggested solution

Improve the error messaging to explain the issue is due to an invalid package.json file.

Alternative

Perhaps more commands could be updated to allow execution regardless of package.json syntax issues, e.g. vp lint, vp format, etc, assuming the node_modules are at least already installed.

Additional context

The following reproduces the issue:

mkdir vp-test
cd vp-test
echo '.' > package.json
vp install

This will output:

VITE+ - The Unified Toolchain for the Web

error: Failed to download Node.js runtime: expected value at line 1 column 1

Everything performed using the latest Vite+ v0.3.1.

Validations

  • Read the Contributing Guidelines.
  • Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
  • Check that there isn't already an issue requesting the same feature.

Activity

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

Metadata

Metadata

Assignees

Fields

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions