SAP-samples / SAP-samples/codejam-code-based-agents
JavaScript track: npm install can resolve an incompatible @langchain/core, even though the committed lockfile is fine
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 54
- Fork
- 36
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Summary
package.json (both starter-project and solution) pins:
json "@langchain/core": "1.1.39", "@langchain/langgraph": "1.2.8",
The committed package-lock.json resolves @langchain/langgraph-checkpoint (a transitive dependency of @langchain/langgraph) to 1.0.1, which is compatible with @langchain/core@1.1.39. So the lockfile itself is internally consistent.
The problem: the exercises instruct learners to run npm install, not npm ci. npm install can re-resolve transitive dependencies against whatever's currently newest on the npm registry rather than strictly honoring the lockfile. @langchain/langgraph-checkpoint has since published newer versions (currently 1.1.3) that require @langchain/core: ^1.1.48 — incompatible with the exact 1.1.39 pin. A fresh npm install today resolves to this newer, incompatible version.
Effect
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './utils/uuid' is not defined by "exports" in .../node_modules/@langchain/core/package.json imported from .../@langchain/langgraph/node_modules/@langchain/langgraph-checkpoint/dist/id.js
thrown immediately on npx tsx src/basicAgent.ts (or any entry point importing @langchain/langgraph), since @langchain/core@1.1.39 doesn't yet expose the ./utils/uuid export subpath that the newer langgraph-checkpoint@1.1.3 needs.
Suggested fix
Either:
- Bump the pinned
@langchain/coreversion inpackage.jsonto something satisfying^1.1.48(e.g.1.1.49or later), removing the fragility of the exact pin against a moving transitive dependency, or - Have learners run
npm ciinstead ofnpm installin the exercise instructions, so the exact working dependency tree from the committed lockfile is used rather than a fresh, potentially-drifted resolution (tradeoff: learners then don't get any newer patch versions of pinned packages).
Option 1 is more robust long-term, since this kind of drift will keep recurring as the npm ecosystem publishes new versions over time, regardless of the lockfile.
Environment
Reproduced on a personal SAP AI Core tenant, JavaScript/TypeScript track, npm install run fresh in starter-project/ (not npm ci), Node.js v24.18.0.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với package.json trong cả starter-project và solution, package-lock.json đã được commit và hướng dẫn của bài tập về việc cài đặt dependency. Tái hiện lỗi bằng một npm install mới trong starter-project, sau đó chạy npx tsx src/basicAgent.ts để xác nhận lỗi. Công việc được xem là hoàn tất khi cả hai cấu hình bài tập đều sử dụng cây dependency tương thích và entry point chạy mà không có package export error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- build-system
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 76/100