Skip to content

[🐞] Deno fails to build Qwik app due to missing Deno.platform (changed API) #7813

@ryansuhartanto

Description

@ryansuhartanto

Which component is affected?

Qwik Runtime

Describe the bug

Getting started with Qwik City and running deno run build would product this error:

error during build:
TypeError: Deno.platform is not a function
    at getSystem (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/@builder.io+qwik@1.15.0/node_modules/@builder.io/qwik/dist/optimizer.mjs:1290:19)
    at async createOptimizer (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/@builder.io+qwik@1.15.0/node_modules/@builder.io/qwik/dist/optimizer.mjs:1411:40)
    at async Object.init2 [as init] (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/@builder.io+qwik@1.15.0/node_modules/@builder.io/qwik/dist/optimizer.mjs:2224:27)
    at async config (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/@builder.io+qwik@1.15.0/node_modules/@builder.io/qwik/dist/optimizer.mjs:6529:7)
    at async runConfigHook (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/vite@5.3.5/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:66394:19)
    at async resolveConfig (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/vite@5.3.5/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:65845:12)
    at async build (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/vite@5.3.5/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:64914:18)
    at async CAC.<anonymous> (file:///home/nexus/Dokumen/suhartanto/VCS/qwik-deno-issue/node_modules/.deno/vite@5.3.5/node_modules/vite/dist/node/cli.js:828:5)

❌ Error: Client build failed: Error: Command failed with exit code 1: deno run build.client

Reproduction

https://github.com/ryansuhartanto/qwik-deno-issue

Steps to reproduce

  • deno -v v2.4.3
  • deno install --allow-scripts
  • deno run build

System Info

System:
    OS: Linux 6.16 Arch Linux
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 2.50 GB / 15.34 GB
    Container: Yes
    Shell: 4.0.2 - /usr/bin/fish
  Binaries:
    Node: 24.5.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 11.4.2 - /usr/bin/npm
    pnpm: 10.14.0 - /usr/bin/pnpm
    bun: 1.2.20 - /usr/bin/bun
  Browsers:
    Brave Browser: 139.1.81.131
  npmPackages:
    @builder.io/qwik: ^1.15.0 => 1.15.0 
    @builder.io/qwik-city: ^1.15.0 => 1.15.0 
    typescript: 5.4.5 => 5.4.5 
    undici: * => 7.13.0 
    vite: 5.3.5 => 5.3.5

Additional Information

Changing the line in

if (sysEnv === 'node' || sysEnv === 'bun') {
sys.path = await sys.dynamicImport('node:path');
sys.cwd = () => process.cwd();
sys.os = process.platform;
} else if (sysEnv === 'deno') {
sys.path = await sys.dynamicImport('node:path');
sys.cwd = (): string => Deno.cwd();
sys.os = Deno.platform();
}

to:

  sys.path = await sys.dynamicImport('node:path');
  sys.cwd = () => process.cwd();
  sys.os = process.platform;

would do as a workaround for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageNew issue which needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions