Skip to content

Commit

Permalink
fix: Allow Node 18 again to make Stackblitz work
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusschiesser committed Dec 3, 2024
1 parent cf9a935 commit f2df558
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/good-ants-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"llamaindex": patch
"@llamaindex/env": patch
---

Allow Node 18 again (throw run-time error if not possible) to make Stackblitz work
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x, 23.x]
node-version: [18.x, 20.x, 22.x, 23.x]
name: E2E on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x, 23.x]
node-version: [18.x, 20.x, 22.x, 23.x]
name: Test on Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 7 additions & 0 deletions packages/env/src/internal/multi-model/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ export {
} from "./shared.js";

export async function loadTransformers(onLoad: OnLoad) {
const nodeVersions = process.versions.node.split(".");
if (nodeVersions[0] && parseInt(nodeVersions[0], 10) < 20) {
throw new Error(
"@huggingface/transformers is not supported on Node.js versions below 20",
);
}

if (getTransformers() === null) {
setTransformers(await import("@huggingface/transformers"));
} else {
Expand Down
3 changes: 1 addition & 2 deletions packages/llamaindex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
}
},
"devDependencies": {
"@huggingface/transformers": "^3.0.2",
"@swc/cli": "^0.5.0",
"@swc/core": "^1.9.2",
"@vercel/postgres": "^0.10.0",
Expand All @@ -98,7 +97,7 @@
"typescript": "^5.6.3"
},
"engines": {
"node": ">=20.0.0"
"node": ">=18.0.0"
},
"types": "./dist/type/index.d.ts",
"main": "./dist/cjs/index.js",
Expand Down

0 comments on commit f2df558

Please sign in to comment.