-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
The AI SDK codebase contains 41+ packages that use Unix-specific rm -rf
commands in their package.json
clean scripts, causing build failures on Windows systems.
Root Cause
All packages use this pattern in their package.json
:
"clean": "rm -rf dist *.tsbuildinfo"
On Windows, rm
is not a recognized command, causing:
'rm' is not recognized as an internal or external command,
operable program or batch file.
Reproduction Steps
- Clone the AI SDK repository on a Windows machine
- Run
npm install
orpnpm install
to install dependencies - Run
npm run test
from the root directory - Build fails at the first package requiring a clean step
Expected behavior: Tests run successfully across all packages
Actual behavior: Build fails with 'rm' is not recognized
error
Affected Packages
At least 41 packages are affected, including:
@ai-sdk/provider
@ai-sdk/anthropic
@ai-sdk/openai
@ai-sdk/react
@ai-sdk/vue
@ai-sdk/svelte
@ai-sdk/angular
- And 34+ other packages in the monorepo
Environment
- Operating System: Windows 10/11
- Shell: PowerShell/Command Prompt
- Node.js: Any version
- Package Manager: npm/pnpm
Error Output
> @ai-sdk/[email protected] clean
> rm -rf dist *.tsbuildinfo
'rm' is not recognized as an internal or external command,
operable program or batch file.
ELIFECYCLE Command failed with exit code 1.
Proposed Solutions
The issue can be resolved by replacing rm -rf
commands with cross-platform alternatives:
Option 1: Use del-cli
(Recommended)
"clean": "del-cli dist *.tsbuildinfo"
Option 2: Use rimraf
"clean": "rimraf dist *.tsbuildinfo"
Option 3: Native Node.js solution
"clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\""
Impact
- Contributors: Windows developers cannot run the full test suite
- CI/CD: Potential build failures on Windows runners
- Development Experience: Inconsistent cross-platform behavior blocks Windows contributor onboarding
This affects the build pipeline and testing workflow, potentially impacting contributor onboarding and CI reliability on Windows environments.
AI SDK Version
Affected versions include the latest releases:
- ai: 4.1.2+
- @ai-sdk/provider: 2.0.0+
- @ai-sdk/anthropic: 2.0.0+
- @ai-sdk/openai: 1.0.0+
- @ai-sdk/react: 2.0.0+
- All packages in the monorepo that use rm -rf in clean scripts
Code of Conduct
- I agree to follow this project's Code of Conduct