Skip to content

[Bug]: sparkling java path verification missed undefined #117

Description

@wwxiaoqi

Preflight checklist

  • I searched existing issues to avoid duplicates.
  • I can reproduce this issue on the latest main (or have provided the exact version/commit below).

Component

packages/sparkling-cli

What happened?

PS D:\200_Projects\my-app> npm install -D --save-exact sparkling-app-cli@2.1.0-rc.33

up to date in 731ms

139 packages are looking for funding
  run `npm fund` for details
npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts:
npm warn allow-scripts   core-js@3.47.0 (install: (install scripts present))
npm warn allow-scripts
npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts <pkg>` to allow.
PS D:\200_Projects\my-app> 
PS D:\200_Projects\my-app> npx sparkling doctor                                     

Sparkling Doctor
================

General:
  [✓] Node.js 24.18.0 (required: ^22 || ^24)
D:\200_Projects\my-app\node_modules\sparkling-app-cli\dist\commands\doctor\checks.js:79
            const text = typeof stderr === 'string' ? stderr.trim() : stderr.toString('utf8').trim();
                                                                             ^

TypeError: Cannot read properties of undefined (reading 'toString')
    at getJavaVersionOutput (D:\200_Projects\my-app\node_modules\sparkling-app-cli\dist\commands\doctor\checks.js:79:78)
    at checkJdk (D:\200_Projects\my-app\node_modules\sparkling-app-cli\dist\commands\doctor\checks.js:137:20)
    at doctor (D:\200_Projects\my-app\node_modules\sparkling-app-cli\dist\commands\doctor\index.js:66:51)
    at Command.<anonymous> (D:\200_Projects\my-app\node_modules\sparkling-app-cli\dist\index.js:143:31)
    at Command.listener [as _actionHandler] (D:\200_Projects\my-app\node_modules\commander\lib\command.js:542:17)
    at D:\200_Projects\my-app\node_modules\commander\lib\command.js:1502:14
    at Command._chainOrCall (D:\200_Projects\my-app\node_modules\commander\lib\command.js:1386:12)
    at Command._parseCommand (D:\200_Projects\my-app\node_modules\commander\lib\command.js:1501:27)
    at D:\200_Projects\my-app\node_modules\commander\lib\command.js:1265:27
    at Command._chainOrCall (D:\200_Projects\my-app\node_modules\commander\lib\command.js:1386:12)

Node.js v24.18.0
PS D:\200_Projects\my-app>

Steps to reproduce

On a Windows device without a JDK environment:

  1. npm install -D --save-exact sparkling-app-cli@2.1.0-rc.33
  2. npx sparkling doctor

Expected behavior

D:\200_Projects\my-app>npx sparkling doctor

Sparkling Doctor
================

General:
  [✓] Node.js 24.18.0 (required: ^22 || ^24)

Android:
  [✗] JDK (required: >= 11) — Java is not installed or not found in PATH
  [✓] Android SDK C:\Users\XXXXXXXX\AppData\Local\Android\Sdk
  [✓] adb 1.0.41

iOS:
  [-] Xcode — Not on macOS — Xcode check skipped
  [-] CocoaPods — Not on macOS — CocoaPods check skipped
  [-] iOS Simulator — Not on macOS — iOS Simulator check skipped

────────────────────────────────────────
1 issue found.

To fix them, copy the following prompt into your Coding Agent (e.g. Cursor):

┌─────────────────────────────────────────────────────────────────────────────┐
│  My Sparkling project environment has the following issues:                 │
│  1. Java (JDK) is not installed. I need JDK 11 or higher.                   │
│  Please help me fix my environment so I can build and run a Sparkling app.  │
└─────────────────────────────────────────────────────────────────────────────┘


D:\200_Projects\my-app>

Actual behavior

~

Logs / screenshots

Environment

  • Host OS: Windows
  • Target platform (Android/iOS): ~
  • Node.js version: 24.18.0
  • pnpm version: ~
  • Lynx version: ~
  • Sparkling version / commit: 2.1.0-rc.33

Contribution

  • I’m willing to submit a PR to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions