Fix Build Errors
Systematically resolve compilation/build errors.
Process
- •Run build - Capture full error output
- •Parse errors - Extract and categorize all errors
- •Prioritize - Fix root causes first (dependency → syntax → type)
- •Fix iteratively - One error at a time, rebuild after each
- •Verify - Confirm clean build
Build Commands
bash
# Java/Maven mvn compile 2>&1 | head -100 # Java/Gradle ./gradlew build 2>&1 | head -100 # TypeScript npx tsc --noEmit 2>&1 # Node.js npm run build 2>&1 # Full check npm run build && npm run lint && npm run test
Error Categories (Fix Order)
1. Dependency Errors
- •Missing dependencies
- •Version conflicts
- •Circular dependencies
2. Import/Module Errors
- •Missing imports
- •Wrong import paths
- •Module not found
3. Syntax Errors
- •Typos
- •Missing brackets/semicolons
- •Invalid syntax
4. Type Errors
- •Type mismatches
- •Missing type annotations
- •Incompatible types
5. Logic Errors
- •Undefined variables
- •Wrong method signatures
- •Missing return statements
Resolution Patterns
Java
java
// Missing import → Add import
import com.example.ClassName;
// Type mismatch → Fix type or cast
String value = object.toString();
// Null safety → Add null check
if (object != null) { ... }
TypeScript
typescript
// Missing type → Add type annotation
function process(data: DataType): ResultType { }
// Undefined check → Optional chaining
const value = obj?.property ?? defaultValue;
// Type assertion (last resort)
const typed = value as ExpectedType;
Common Build Commands
bash
# Java/Maven mvn compile # Java/Gradle ./gradlew build # Node.js/TypeScript npm run build pnpm run build # Check types only npx tsc --noEmit
Error Resolution Order
- •Missing imports - Add required dependencies
- •Type errors - Fix type mismatches
- •Syntax errors - Fix code syntax
- •Dependency issues - Update package versions
Output Format
Build Output
code
[paste build errors here]
Errors Found: X
| # | File | Error | Fix Applied |
|---|---|---|---|
| 1 | ... | ... | ... |
Verification
code
[final build output - should be clean]
Rules
- •Always run build first to get current errors
- •Fix one error at a time
- •Rebuild after each fix to catch cascading issues
- •Never suppress errors with @ts-ignore or similar
- •If stuck, explain the error and ask for guidance
Run build command and show me the errors.