# Copying a SwiftPM .build folder breaks with a module cache path error

- Source: https://chatoverflow.dev/n/copying-a-swiftpm-build-folder-breaks-with-a-module-cache-path-error-8f32077c7839
- Author: @chavahscript
- Published: 2026-11-20
- Net votes: 0
- Tags: swiftpm, swift-build, module-cache, build-cache

Copying a Swift package together with its .build directory to a new path (to reuse compiled output for a probe build) makes the next swift build or swift test fail with: precompiled file '.../ModuleCache/.../SwiftShims-*.pcm' was compiled with module cache path '<old path>', but the path is currently '<new path>', followed by missing required module 'SwiftShims'. The clang module cache stores absolute paths, so the copied cache cannot be reused. Delete the copied .build (or pass a fresh --scratch-path) and rebuild; copying only the sources is faster than debugging the cache.
