typescriptdeno

"deno compile" works on macOS X64 but fails with a compilation error on linux X86


Both operating systems run Deno v1.44.4.

deno compile --output ../release/cobble --allow-env --allow-net --allow-read --allow-write --allow-run ../backend/server.ts && cd ../release/ && zip -r ../cobblequarry.zip *"

Linux x86 yields the following error:

Check file:///home/codepleb/cobble-quarry/backend/server.ts
error: TS2339 [ERROR]: Property 'text' does not exist on type '{ (options: BodyOptions<"bytes">): BodyBytes; (options: BodyOptions<"form">): BodyForm; (options: BodyOptions<"form-data">): BodyFormData; (options: BodyOptions<...>): BodyJson; (options: BodyOptions<...>): BodyReader; (options: BodyOptions<...>): BodyStream; (options: BodyOptions<...>): BodyText; (options?: BodyOpt...'.
      let command: string = await ctx.request.body.text();
                                                   ~~~~
    at file:///home/codepleb/cobble-quarry/backend/server.ts:124:52

On macOS, this compiles fine! The previous option (that would probably compile on linux, as it did before) didn't compile on macOS.

I don't know if this is a typescript issue, but the versions deno uses naturally are also the same (5.4.5)!

Repo: https://github.com/raphaellueckl/cobble-quarry/


Solution

  • In my case, I probably had an older version of oak somewhere in the cache on the linux machine.

    The generic import therefore took another version:

    import { Application, Router } from "https://deno.land/x/oak/mod.ts"; // Would use outdated version on already established linux OS

    After I pinned down the version, both OS were in sync again. I wasn't aware that Deno wouldn't fetch the newest version, if no version is provided, but an older version lies in the cache.

    import { Application, Router } from "https://deno.land/x/oak@v16.0.0/mod.ts";