# Could not locate Gemfile

**URL:** <https://forum.codecrafters.io/t/could-not-locate-gemfile/16007>\
**Category:** Bug Reports\
**Tags:** challenge:shell\
**Created:** [March 22, 2026, 6:20pm UTC](https://forum.codecrafters.io/t/could-not-locate-gemfile/16007 "2026-03-22T18:20:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![d-i-bondarenko](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/d-i-bondarenko/32/17774_2.png) [@d-i-bondarenko](https://forum.codecrafters.io/u/d-i-bondarenko)\
**Post date:** [March 22, 2026, 6:20pm UTC](https://forum.codecrafters.io/t/could-not-locate-gemfile/16007/1 "2026-03-22T18:20:24Z")

</div>

I’m stuck on Stage #ZV2.

I’ve tried to find similar problems on that stage:

- [Getting exec: zig-out/bin/main: not found error](https://forum.codecrafters.io/t/getting-exec-zig-out-bin-main-not-found-error/15934)
- [Error while finding module specification for 'app.main'](https://forum.codecrafters.io/t/error-while-finding-module-specification-for-app-main/15933)

Here are my logs from test run:

```plaintext
[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.
Debug = true
[tester::#ZV2] Running tests for Stage #ZV2 (Filename Completion - File completion)
[tester::#ZV2] [working_dir] - pineapple-71.txt
[tester::#ZV2] Running ./your_program.sh
[your-program] Could not locate Gemfile
[tester::#ZV2] ^ Expected prompt ("$ ") but received "Could not locate Gemfile"
[tester::#ZV2] Test failed

```

And here’s a snippet of .codecrafters/run.sh:

```bash
#!/bin/sh
#
# This script is used to run your program on CodeCrafters
#
# This runs after .codecrafters/compile.sh
#
# Learn more: https://codecrafters.io/program-interface

set -e # Exit on failure

exec bundle exec ruby app/main.rb "$@"

```

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [March 22, 2026, 6:20pm UTC](https://forum.codecrafters.io/t/could-not-locate-gemfile/16007/2 "2026-03-22T18:20:24Z")

</div>

Hi, thanks for your post!

I’m currently out of the office and will be back on March 23. I’ll get back to you as soon as possible once I return.

---

<div class="post-metadata">

**Author:** ![d-i-bondarenko](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/d-i-bondarenko/32/17774_2.png) [@d-i-bondarenko](https://forum.codecrafters.io/u/d-i-bondarenko)\
**Post date:** [March 22, 2026, 7:41pm UTC](https://forum.codecrafters.io/t/could-not-locate-gemfile/16007/3 "2026-03-22T19:41:29Z")

</div>

Found the issue and this fix worked fine.

It required to change .codecrafters/run.sh to this:

```bash
set -e # Exit on failure

SCRIPT_DIR=$(dirname "$0")
export BUNDLE_GEMFILE="$SCRIPT_DIR/Gemfile"

exec bundle exec ruby "$SCRIPT_DIR/app/main.rb" "$@"

```

I assume that such change would be better to note in the first task of file completion module, so devs could check their CI script.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [March 29, 2026, 2:07am UTC](https://forum.codecrafters.io/t/could-not-locate-gemfile/16007/5 "2026-03-29T02:07:14Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
