Skip to content

[Bug]: (Windows) Failed to load app config via ESM #63

Description

@jchu634

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/create-sparkling-app

What happened?

Got error when trying to run Android with fresh app using latest rc or lateston Windows:

Failed to read app config for autolink, using defaults: Error: Failed to load app config via ESM: node:internal/modules/run_main:107
    triggerUncaughtException(
    ^
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:183:11)
    at defaultLoad (node:internal/modules/esm/load:78:3)
    at nextLoad (node:internal/modules/esm/hooks:748:28)
    at Hooks.load (node:internal/modules/esm/hooks:385:26)
    at ModuleLoader.load (node:internal/modules/esm/loader:837:35)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:612:31)
    at #createModuleJob (node:internal/modules/esm/loader:643:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:353:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:318:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Steps to reproduce

  1. Create new project
  2. Install dependencies
  3. Try to run npm run run:android

Expected behavior

App opens with the Android Emulator

Actual behavior

Errors out and exits
Failed to read app config for autolink, using defaults: Error: Failed to load app config via ESM

Logs / screenshots

PS C:\Users\USER\Documents\Repos> npm create sparkling-app@rc testApp2

> npx
> create-sparkling-app testApp2

┌  create-sparkling-app v2.1.0-rc.12
  ↳ Will create in testApp2
│
◇  Choose a template
│  sparkling-default (Official Sparkling starter project)
│
◇  Android Gradle build files
│  Kotlin DSL (.gradle.kts)
│
◇  Select development tools
│  none
│
◇  Select optional tooling
│  none
│
◇  Package namespace (Android package / iOS bundle id)
│  com.testapp2
│
◇  Initialize a git repository?
│  Yes
Installing npm template: sparkling-app-template@latest
Building project with 2 steps
Running create-app actions...
│
◇  Finished action: create-app-project (took 198ms)

Output paths:
  - C:\Users\USER\Documents\Repos\testApp2

All actions completed.
│
◇  Install JS dependencies now with npm?
│  Yes
│
◇  Installed with npm
│
◇  Initialized git repository
│
◇  ✔ Project created at testApp2 ───────────────────────────────────────────╮
│                                                                           │
│  cd testApp2                                                              │
│  Dependencies installed. If you change tooling, re-run install manually.  │
│  npm run run:ios                                                          │
│  npm run run:android                                                      │
│                                                                           │
│  Tip iOS: ensure Xcode Command Line Tools are installed.                  │
│  Tip Android: ensure ANDROID_HOME and SDK platforms are set.              │
│                                                                           │
├───────────────────────────────────────────────────────────────────────────╯
│
└  Happy hacking!

PS C:\Users\USER\Documents\Repos> cd .\testApp2\
PS C:\Users\USER\Documents\Repos\testApp2> npm run run:android

> testApp2@1.0.0 run:android
> sparkling-app-cli run:android

Failed to read app config for autolink, using defaults: Error: Failed to load app config via ESM: node:internal/modules/run_main:107
    triggerUncaughtException(
    ^
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:183:11)
    at defaultLoad (node:internal/modules/esm/load:78:3)
    at nextLoad (node:internal/modules/esm/hooks:748:28)
    at Hooks.load (node:internal/modules/esm/hooks:385:26)
    at ModuleLoader.load (node:internal/modules/esm/loader:837:35)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:612:31)
    at #createModuleJob (node:internal/modules/esm/loader:643:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:353:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:318:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

Node.js v24.14.1
Autolinked 1 module(s) for ANDROID.
Building Lynx bundle with config from app.config.ts
node:internal/child_process:286
      const err = new ErrnoException(exitCode, syscall);
                  ^

Error: spawn rspeedy ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn rspeedy',
  path: 'rspeedy',
  spawnargs: [
    'build',
    '--config',
    'C:\\Users\\USER\\Documents\\Repos\\testApp2\\.sparkling\\lynx.config.ts'
  ]
}

Environment

  • Host OS: Windows
  • Target platform (Android/iOS): Android
  • Node.js version: v24.114.1
  • pnpm version:
  • Lynx version:
  • Sparkling version / commit: 2.1.0-rc.12 or 2.0.1

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