Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 2.3 KB

File metadata and controls

59 lines (45 loc) · 2.3 KB

Agents4Energy Dependency and Build Configuration

Identified Issues

  1. Node.js Version Incompatibility

    • Some packages require Node.js v20+ or v22+
    • Build environment was using Node.js v18.20.6
    • Affected packages: path-scurry@2.0.0, minimatch@10.0.1
  2. Missing Build Script

    • The build process was trying to run npm run build:backend
    • This script doesn't exist in package.json
  3. Package Access Issues

    • 403 Forbidden errors when trying to download npm packages
    • Specifically for camelcase@6.3.0 and camel-case@4.1.2
  4. AWS Amplify Deprecation Warnings

    • Multiple @aws-amplify/* packages showed deprecation warnings
    • Message: "backend-cli 1.6.0 does not work with Amplify Hosting service"

Applied Solutions

  1. Build Configuration Alignment

    • Synchronized package.json and amplify.yml with main branch
    • Using standard Amplify build configuration with npm ci
    • Removed custom build:backend script
  2. Dependency Management

    • Using npm ci with cache for faster, more reliable builds
    • Using --prefer-offline flag to prioritize cached packages
    • Properly configured cache paths for node_modules and .npm

Best Practices for Dependency Management

  1. Version Pinning

    • Use exact versions for critical dependencies
    • Consider using package locks for consistent installations
  2. Regular Updates

    • Run npm audit regularly to check for vulnerabilities
    • Use npm update to keep dependencies current
    • Consider automated dependency updates with tools like Dependabot
  3. Build Environment Consistency

    • Use .nvmrc or similar to specify Node.js version
    • Document environment requirements in README
    • Consider containerization for complete environment control
  4. Amplify-Specific Recommendations

    • Keep Amplify CLI versions aligned with Amplify Hosting requirements
    • Test locally before deploying to catch compatibility issues
    • Review Amplify documentation for version compatibility guidance

References