Fix Build Failure - Build fails in sandbox due to missing build toolchain (#831)

This commit is contained in:
Abhi
2025-06-08 01:04:20 -04:00
committed by GitHub
parent f11eb41383
commit 6e4b84a60d
3 changed files with 27 additions and 1 deletions

View File

@@ -97,6 +97,29 @@ npm run test
This will run tests located in the `packages/core` and `packages/cli` directories. Ensure tests pass before submitting any changes.
#### Important Note for Sandbox Users on macOS/Windows
This project uses native dependencies (e.g., `tree-sitter`) that are compiled for a specific operating system.
When you run the application in the development sandbox via `npm start`, these dependencies are automatically rebuilt for the container's Linux environment.
Because of this, if you then try to run `npm run test` directly on your host machine (e.g., macOS), the tests will fail with an error similar to `dlopen` or `not a valid mach-o file`. This is because the test runner on your Mac cannot load the Linux-compiled dependencies from your `node_modules` folder.
#### The Solution:
To fix this, you must rebuild the native dependencies for your host machine's architecture before running the tests.
```bash
npm rebuild
```
#### Recommended Workflow:
1. After using the sandboxed `npm start`, and before you want to run tests locally, run `npm rebuild` in your terminal.
2. Then, run `npm run test` as usual.
You will need to repeat the npm rebuild step any time you switch from running the sandboxed application back to running local tests.
### Linting and Preflight Checks
To ensure code quality, formatting consistency, and run final checks before committing: