TypeScript Build Errors with Node 22 & Yarn 4 in Speckle Monorepo (Server/Viewer issues, others OK i think..)

Hi Speckle Developers,

I’m trying to set up a local development environment for the Speckle server, specifically running yarn build (from the root).

I’m currently using:

  • Node.js v22.14.0
  • Yarn v4.5.0

I’m consistently encountering TypeScript compilation errors, primarily related to the @speckle/server and @speckle/viewer packages. Notably, other packages like @speckle/tailwind-theme, @speckle/objectloader, @speckle/objectsender, @speckle/preview-frontend, and @speckle/ui-components seem to build successfully.

The errors for server and viewer are:

  1. Conflicting @types/express definitions (Server):
    Errors like
    Type 'import("...node_modules/@types/express-session/node_modules/@types/express/index").RequestHandler<...>' is not assignable to type 'import("...node_modules/@types/express/index").RequestHandler<...>'.
    This suggests multiple versions of Express types are being picked up.
  2. AWS SDK type mismatches (Server):
    Errors regarding missing properties like identifyOnResolve, Body, or ContentLength on ServiceOutputTypes, indicating potential conflicts between AWS SDK v2/v3 types.
  3. Apollo Server context type issues (Server):
    Errors where BaseContext is not assignable to GraphQLContext, often missing properties like auth.
  4. @speckle/viewer tsconfig.json:
    TS5110: Option 'module' must be set to 'Node16' when option 'moduleResolution' is set to 'Node16'.
    (Though I’ve tried setting both to NodeNext to align with Node 22)

I’ve already tried:

  • Updating packages/server/tsconfig.json and packages/viewer/tsconfig.json to NodeNext for module and moduleResolution.
  • Adding explicit resolutions for @types/express, @types/express-session, @types/express-serve-static-core, @types/passport, and @aws-sdk/types in the root package.json.
  • Performing full node_modules and yarn.lock cleanups followed by yarn install after each change.

Could you please advise on the recommended approach for these specific type resolution issues in the @speckle/server and @speckle/viewer packages within the monorepo, especially with Node 22 and Yarn 4?

Thanks in advance for any help!

Hi @Asybel_Bintang

Can’t say for sure about the server package build errors, but the one from the viewer package

Is harmless and it does not stop the package from building

Cheers