-
Notifications
You must be signed in to change notification settings - Fork 67
letta-code: Fix sharp module loading on all platforms #2040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Mic92 <[email protected]>
…rt (WIP) - Added package-lock.json generated with --legacy-peer-deps - Created hashes.json and update.py for automated updates - Converted from fetchzip to buildNpmPackage to properly install npm dependencies - Added NPM_CONFIG_LEGACY_PEER_DEPS and npmRebuildFlags to handle peer dependencies - Added debugging to investigate build issues - Issue: npm rebuild is still running prepare scripts despite --ignore-scripts Co-authored-by: Mic92 <[email protected]>
- Converted from fetchzip to buildNpmPackage to properly handle platform-specific dependencies - Added NPM_CONFIG_IGNORE_SCRIPTS and NPM_CONFIG_LEGACY_PEER_DEPS environment variables - Added npmRebuildFlags to prevent postinstall scripts from running - Package now correctly installs sharp's platform-specific binaries - Tested and verified letta --version and --help work correctly - Version check enabled and passing Fixes the EAI_AGAIN error when sharp tries to load platform-specific binaries Co-authored-by: Mic92 <[email protected]>
|
@copilot the github repo has a lock file why do we provide our own? |
The letta-code repository includes a package-lock.json in the main branch. Updated the update script to fetch it directly from GitHub instead of generating it. Added fallback to generation if GitHub fetch fails. Co-authored-by: Mic92 <[email protected]> Co-authored-by: Mic92 <[email protected]>
- Removed custom update.py script (use nix-update instead) - Removed hashes.json (inline version and hashes for nix-update) - Use npm tarball which includes pre-built letta.js - Package-lock.json should be updated from GitHub main branch when needed - All hashes inline in package.nix for standard nix-update workflow Co-authored-by: Mic92 <[email protected]> Co-authored-by: Mic92 <[email protected]>
- Use npm tarball (pre-built letta.js, no bun needed) - Fetch package-lock.json from GitHub main branch during build - All hashes inline for nix-update compatibility - Simpler approach that doesn't require custom update scripts - Tested and working with sharp multi-platform support Fixes #issue with sharp failing to load platform-specific binaries Co-authored-by: Mic92 <[email protected]> Co-authored-by: Mic92 <[email protected]>
We ARE using the GitHub repo's lockfile - we fetch it from the main branch at line 22. The approach is: npm tarball (has pre-built letta.js) + GitHub lockfile (has package-lock.json). We can't use the GitHub source directly because it requires bun to build (see package.json scripts.build: "node scripts/postinstall-patches.js && bun run build.js"), and the npm tarball doesn't include the lockfile. So we fetch the lockfile separately from GitHub and apply it to the npm tarball. |
The package failed at runtime with "Could not load the sharp module" because platform-specific native binaries weren't being installed. The simple
fetchzipapproach didn't handle npm dependencies.Changes:
buildNpmPackageto properly install npm dependencies including sharp's platform-specific optionalDependenciespackage-lock.jsonfrom GitHub main branch during build (npm tarball excludes it, but repo includes it)NPM_CONFIG_IGNORE_SCRIPTS=trueandnpmRebuildFlagsto prevent postinstall scripts from attempting network accesspackage.nixfor standardnix-updatecompatibilityTechnical Details:
The npm tarball contains pre-built
letta.jsbut no lockfile. GitHub source has the lockfile but requires bun to build. Solution: fetch lockfile from GitHub and apply it to the npm tarball.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.