2

I recently upgraded to Rails 7. Everything works locally (including bundle exec rails assets:precompile however if I build my app in Docker (to deploy to Fly) I get to this line: RUN bundle exec rails assets:precompile and then things fail with this message:

#23 16.19 Compiling...
#23 18.46 Compilation failed:
#23 18.46 Internal Error: project@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
#23 18.46     at pQ.getCandidates (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:435:5146)
#23 18.46     at Wf.getCandidates (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:391:1264)
#23 18.46     at /root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:439:7695
#23 18.46     at Rf (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:390:8965)
#23 18.46     at ge (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:439:7675)
#23 18.46
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -c bundle exec rails assets:precompile]: exit code: 1

From what I can tell this error #23 18.46 Internal Error: project@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile is the crux of the issue (project@workspace is just my project's name @workspace). Generally I would expect this to list a package, but there is none listed. I've deleted the lock file, yarn install works. Nothing seems out of place with package.json.

Any thoughts on what might be breaking the precompilation?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
tfantina
  • 788
  • 11
  • 37

1 Answers1

0

Let's make sure you are using the same Ruby version in the host machine and in the docker. In you Dockerfile specify the following in the beginning:

RUN gem install rails -v 7.0.0

Try to also remove the yarn.lock file and do yarn install --force instead.

See if this works.

Feras Wilson
  • 380
  • 1
  • 3
  • 13
  • Thanks for the suggestions. I'm not sure this was the issue in my case. I was eventually able to get everything deployed but the asset pipeline is totally broken, any page with assets in the pipeline breaks. I've shifted away from this project for now so I don't think I'll get a chance to try fixing that. – tfantina Jan 17 '23 at 23:03