#Cannot find module '@libsql/linux-x64-gnu

1 messages · Page 1 of 1 (latest)

snow moat
#

My runs have suddently started failing with:

`Error: Cannot find module '@libsql/linux-x64-gnu'
Require stack:

  • /app/chunk-KGPBUPHT.mjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1142:15)
    at Function.Module._load (node:internal/modules/cjs/loader:983:27)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at file:///app/chunk-KGPBUPHT.mjs:10:54
    at requireNative (file:///node_modules/.pnpm/[email protected]/node_modules/libsql/index.js:22:10)
    at ../../node_modules/.pnpm/[email protected]/node_modules/libsql/index.js (file:///node_modules/.pnpm/[email protected]/node_modules/libsql/index.js:45:5)
    at __require2 (file:///app/chunk-KGPBUPHT.mjs:17:50)
    at file:///node_modules/.pnpm/@[email protected]/node_modules/@libsql/client/lib-esm/sqlite3.js:1:22
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)`
thin palmBOT
#

Hi @snow moat. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

This error is related to a native module dependency that can't be properly bundled during deployment. The error occurs because the .node files (native code) can't be bundled like regular JavaScript packages.

Solution

You need to add the libsql package to your external build settings in your trigger.config.ts file. This tells the Trigger.dev build system to exclude these packages from bundling and handle them separately.

import { defineConfig } from "@trigger.dev/sdk/v3";

export default defineConfig({
  project: "<project ref>",
  // Your other config settings...
  build: {
    external: ["@libsql/client", "libsql"],
  },
});

This is a common issue with native Node.js modules, and the solution is documented in the troubleshooting section in the deployment docs and common problems docs.

After making this change, try deploying your project again. If you're still having issues, you can use the debug logging and dry run options to troubleshoot further:

npx trigger.dev@latest deploy --log-level debug

or

npx trigger.dev@latest deploy --dry-run

These commands will provide more detailed information about the build process to help diagnose any remaining issues.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: