Skip to content

fix: make setup script cross-platform (fix #7182)#7185

Open
scrollDynasty wants to merge 2 commits into
alibaba:masterfrom
scrollDynasty:fix-setup-script-cross-platform
Open

fix: make setup script cross-platform (fix #7182)#7185
scrollDynasty wants to merge 2 commits into
alibaba:masterfrom
scrollDynasty:fix-setup-script-cross-platform

Conversation

@scrollDynasty

Copy link
Copy Markdown

Summary

This PR makes the repository setup script cross-platform.

Previously, pnpm run setup used the Unix-specific command rm -rf to remove node_modules, which fails on Windows (PowerShell/CMD) and prevents Windows contributors from completing the setup flow.

Changes

  • Replaced rm -rf node_modules with a dependency-free Node.js cleanup script using built-in fs and path.
  • Updated the root setup script to use the cleanup script before pnpm install.
  • Kept the existing setup flow unchanged:
    • clean node_modules
    • install dependencies
    • prebundle
    • build
  • Did not introduce new dependencies or modify pnpm-lock.yaml.

Why not rimraf?

rimraf was considered since it is already used elsewhere in the repository. However, the setup script may run before pnpm install, meaning node_modules binaries (including rimraf) may not exist in fresh clones.

A small Node.js script avoids this bootstrap problem and works in all environments without prerequisites.

Verification

Tested on Windows PowerShell:

node scripts/clean-node-modules.js

Result::

  • Exit code: 0
  • Works even when node_modules is missing
  • Full pnpm run setup was not executed due to its side effects (install, prebundle, build), but the cleanup step integrates without affecting the existing flow.

Related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm run setup fails on Windows PowerShell/CMD because setup uses rm -rf

1 participant