szwgs
@szwgs

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

fly.ioでのデプロイエラー

解決したいこと

fly.ioでのデプロイ時のエラー解決

例)
Ruby on Railsで演奏会の投稿アプリを作ってfly.ioからデプロイしていましたが、ある日からデプロイ時にエラーが出るようになりました。nodeのバージョンに問題があるようなので16.20.0と18.17.1を試しましたがどちらもデプロイできませんでした。
解決方法を教えて下さい。

発生している問題・エラー

node version = 16.20.0の時

[+] Building 3.0s (19/26)
 => [internal] load build definition from Dockerfile                                                       0.0s
 => => transferring dockerfile: 32B                                                                        0.0s
 => [internal] load .dockerignore                                                                          0.0s
 => => transferring context: 35B                                                                           0.0s
 => resolve image config for docker.io/docker/dockerfile:experimental                                      1.3s
 => CACHED docker-image://docker.io/docker/dockerfile:experimental@sha256:600e5c62eedff338b3f7a0850beb7c0  0.0s
 => [internal] load metadata for quay.io/evl.ms/fullstaq-ruby:3.0.6-jemalloc-slim                          0.8s
 => [base 1/6] FROM quay.io/evl.ms/fullstaq-ruby:3.0.6-jemalloc-slim@sha256:f963502980f8ddceec3bf7c350b00  0.0s
 => [internal] load build context                                                                          0.1s
 => => transferring context: 23.85kB                                                                       0.1s
 => CACHED [base 2/6] RUN mkdir /app                                                                       0.0s
 => CACHED [base 3/6] WORKDIR /app                                                                         0.0s
 => CACHED [base 4/6] RUN mkdir -p tmp/pids                                                                0.0s
 => CACHED [base 5/6] RUN curl https://get.volta.sh | bash                                                 0.0s
 => CACHED [base 6/6] RUN volta install node@16.20.0 yarn@latest &&     gem update --system --no-document  0.0s
 => CACHED [stage-4 1/8] RUN --mount=type=cache,id=prod-apt-cache,sharing=locked,target=/var/cache/apt     0.0s
 => CACHED [build_deps 1/1] RUN --mount=type=cache,id=dev-apt-cache,sharing=locked,target=/var/cache/apt   0.0s
 => CACHED [gems 1/2] COPY Gemfile* ./                                                                     0.0s
 => CACHED [node_modules 1/3] COPY package*json ./                                                         0.0s
 => CACHED [node_modules 2/3] COPY yarn.* ./                                                               0.0s
 => CANCELED [gems 2/2] RUN bundle install && rm -rf vendor/bundle/ruby/*/cache                            0.7s
 => ERROR [node_modules 3/3] RUN yarn install                                                              0.7s
------
 > [node_modules 3/3] RUN yarn install:
#0 0.638 Usage Error: This tool requires a Node version compatible with >=18.12.0 (got 16.20.0). Upgrade Node, or set `YARN_IGNORE_NODE=1` in your environment.
#0 0.638
#0 0.638 Yarn Package Manager - 4.0.0-rc.50
#0 0.638
#0 0.638   $ yarn <command>
#0 0.638
#0 0.638 You can also print more details about any of these commands by calling them with
#0 0.638 the `-h,--help` flag right after the command name.
------
Error: failed to fetch an image or build from source: error building: failed to solve: executor failed running [/bin/bash -o pipefail -c yarn install]: exit code: 1

node version = 18.17.0の時

build 29.8s
------
 > [stage-4 8/8] RUN bin/rails fly:build:
#0 5.023 yarn install v1.22.19
#0 5.098 [1/5] Resolving packages...
#0 5.518 [2/5] Fetching packages...
#0 13.83 [3/5] Linking dependencies...
#0 17.26 [4/5] Building fresh packages...
#0 17.55 [5/5] Cleaning modules...
#0 18.99 Done in 13.97s.

~中略~

#0 29.65     at loadPrivatePartialConfig.next (<anonymous>) {
#0 29.65   code: 'ERR_MODULE_NOT_FOUND'
#0 29.65 }
#0 29.65
#0 29.65 Node.js v18.17.1
#0 29.65
------
Error: failed to fetch an image or build from source: error building: failed to solve: executor failed running [/bin/bash -o pipefail -c ${BUILD_COMMAND}]: exit code: 1

都度Dockerfileのnodeバージョンは変更しています。

自分で試したこと

nodeバージョンの変更等

0

1Answer

node version = 16.20.0でNodeバージョンアップを試してエラーが解消されないならNodeのバージョンはそのままで、「set YARN_IGNORE_NODE=1」を試してみてはいいのではないでしょうか。

#0 0.638 Usage Error: This tool requires a Node version compatible with >=18.12.0 (got 16.20.0). Upgrade Node, or set YARN_IGNORE_NODE=1 in your environment.

0Like

Comments

  1. @szwgs

    Questioner

    回答ありがとうございます。
    YARN_IGNORE_NODE=1 in your environment.とありますが、どこにその文言を追加すればよいのかわからず困っております。。。

  2. OSがLinuxであるならば、以下のコマンドで設定できると思いますよ。

    export YARN_IGNORE_NODE=1

    設定できたことの確認は下記です。

    echo $YARN_IGNORE_NODE

    Windowsであれば、以下のURLが参考になると思います。

Your answer might help someone💌