diff --git a/README.md b/README.md index de42af4..848e5a1 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,18 @@ npm install npm run build ``` +### Alpine Linux Setup + +If you're running on Alpine Linux (musl libc), you need an additional setup step after installing dependencies: + +```bash +npm install +npm run alpine:setup +npm run build +``` + +This removes the incompatible `onnxruntime-node` native module and configures the system to use the WASM backend instead. The WASM backend is slightly slower but works on all platforms. + ## Initial Setup Before using the MCP server, you need to index the Babylon.js repositories. This is a one-time setup process. diff --git a/package.json b/package.json index 0b410d0..535cb88 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "test:ui": "vitest --ui", "test:run": "vitest run", "test:coverage": "vitest run --coverage", + "alpine:setup": "sh scripts/alpine-setup.sh", "index:docs": "tsx scripts/index-docs.ts", "index:api": "tsx scripts/index-api.ts", "index:source": "tsx scripts/index-source.ts", diff --git a/scripts/alpine-setup.sh b/scripts/alpine-setup.sh new file mode 100755 index 0000000..90e8102 --- /dev/null +++ b/scripts/alpine-setup.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Alpine Linux setup script +# Removes onnxruntime-node to prevent glibc dependency errors +# The transformers library will fall back to onnxruntime-web (WASM) + +echo "Removing onnxruntime-node for Alpine Linux compatibility..." + +# Remove the onnxruntime-node directory +rm -rf node_modules/onnxruntime-node + +# Create a stub module so imports don't fail +mkdir -p node_modules/onnxruntime-node +cat > node_modules/onnxruntime-node/package.json << 'EOF' +{ + "name": "onnxruntime-node", + "version": "0.0.0-stub", + "main": "index.js", + "type": "module" +} +EOF + +cat > node_modules/onnxruntime-node/index.js << 'EOF' +// Stub module for Alpine Linux +// @xenova/transformers will use onnxruntime-web instead +export default {}; +EOF + +echo "✓ Alpine Linux setup complete - WASM backend will be used"