簡體   English   中英

Fly 部署失敗:RUN bundle exec rails assets:precompile

[英]Fly deployment fails: RUN bundle exec rails assets:precompile

我最近升級到 Rails 7。一切都在本地工作(包括bundle exec rails assets:precompile但是,如果我在 Docker 中構建我的應用程序(部署到 Fly)我得到這一行: RUN bundle exec rails assets:precompile然后事情失敗了這條信息:

#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

據我所知,這個錯誤#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 Internal Error: project@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile是問題的關鍵( project@workspace只是我的項目名稱@workspace)。 通常我希望它列出一個 package,但沒有列出。 我已經刪除了鎖定文件, yarn install工作。 package.json似乎沒有什么不合適的地方。

關於可能破壞預編譯的任何想法?

讓我們確保您在主機和 docker 中使用相同的 Ruby 版本。在您的 Dockerfile 開頭指定以下內容:

RUN gem install rails -v 7.0.0

也嘗試刪除 yarn.lock 文件並改為執行 yarn install --force 。

看看這是否有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM