Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] rm -rf in build scripts is not cross-platform compatible (fails on Windows) #2865

Open
OrkhanGG opened this issue Dec 25, 2024 · 2 comments
Labels
Good First Issue Good for newcomers

Comments

@OrkhanGG
Copy link

Issue

The build script in the project currently uses the rm -rf command to clean the lib directory. This command works on Unix-based systems but fails on Windows, as rm is not recognized as an internal or external command.

This leads to the following error when running the build script on Windows:

'rm' is not recognized as an internal or external command,
operable program or batch file.

Steps to Reproduce

  1. Clone the repository on a Windows machine.
  2. Run yarn install.
  3. Navigate to package directory (cd package)
  4. Run yarn install.

You will end up with:

yarn install v1.22.22
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > @gorhom/[email protected]" has incorrect peer dependency "react-native-reanimated@>=3.16.0".
warning " > [email protected]" has unmet peer dependency "webpack@>=2".
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
$ yarn run build
yarn run v1.22.22
$ rm -rf lib && yarn run --silent build-translations && bob build && yarn run --silent copy-translations
'rm' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Proposed Solution

I'd suggest cross-platform alternative like rimraf which is compatible with both Unix-based systems and Windows. For example:

"scripts": {
  "build": "rimraf lib && yarn run build-translations && bob build && yarn run copy-translations"
}
@oliverlaz
Copy link
Member

hi @OrkhanGG, we mainly use MacOS/Unix environments to develop our products and haven't noticed this issue.
Can you submit a PR with the proposed fix? We'll be happy to merge it.

@OrkhanGG
Copy link
Author

Hi, @oliverlaz, sure, I'll try to contribute soon.

@khushal87 khushal87 added Good First Issue Good for newcomers and removed Needs Triaging labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants