Bitbucket Artifact Not Found Between Steps
A later step expected files from an earlier step, but the artifact was never produced under a matching glob - so the files are not present when the downstream step runs.
What this error means
A build step succeeds, but a later deploy/test step fails because expected files (e.g. dist/) are missing. Each step starts from a clean checkout; only declared artifacts carry forward.
cp: cannot stat 'dist/app.js': No such file or directory
# the build step never declared dist/** as an artifactCommon causes
Producer step did not declare the artifact
Steps do not share a filesystem. Unless the producing step lists the output under artifacts:, the files are discarded when that step ends.
Artifact glob does not match the output path
A glob like build/** will not capture files written to dist/. A mismatch between where files are written and the declared paths yields an empty artifact.
How to fix it
Declare artifacts on the producing step
List the output paths so they are saved and restored into later steps.
- step:
name: Build
script: [ npm run build ]
artifacts:
- dist/**
- step:
name: Deploy
script: [ ./deploy.sh dist ]Match globs to the real output location
- Confirm where the build actually writes files (
ls -Rafter build). - Set the artifact glob to that exact path.
- Remember artifacts only carry to later steps in the same pipeline run.
How to prevent it
- Declare
artifacts:on every step whose output a later step consumes. - Keep artifact globs in sync with build output paths.
- Verify artifact contents with a quick
lsin the consuming step while debugging.