Trying to deploy a Rails 6.x app and having Yarn issues.

I have managed to launch the app and get the database built but when I got to deploy I am getting messages that Yarn is not installed. Yarn and Webpacker are both installed locally and working fine.

Here is the error text…

[stage-4 8/8] RUN bin/rails fly:build:
#26 3.520 Volta error: Yarn is not available.
#26 3.520
#26 3.520 Use volta install yarn to select a default version (see volta help install for more info).
#26 3.849 Volta error: Yarn is not available.
#26 3.849
#26 3.849 Use volta install yarn to select a default version (see volta help install for more info).
#26 3.925 I, [2022-09-19T19:23:11.116217 #1] INFO – : Writing /app/public/assets/error-156d4702ea339f07f4afcf1b3a8376da763dea6f9dc6461f2602c8d3c6371a84.png
#26 3.925 I, [2022-09-19T19:23:11.116891 #1] INFO – : Writing /app/public/assets/gritter-close-b45e4e3265c1091c50b3531a5a7a21b726b397adb6ca081d82797e0d29165781.png
#26 3.926 I, [2022-09-19T19:23:11.117805 #1] INFO – : Writing /app/public/assets/gritter-84f45eb6efbd0f9313e3cf0d81dcea4cbb2ed8552c6babeca799f71a8d879213.png
#26 3.927 I, [2022-09-19T19:23:11.118638 #1] INFO – : Writing /app/public/assets/ie-spacer-c404c6ad7ced964722cc14635cc2e0a5b924b13c4120c02e51f6d16d39553c3a.gif
#26 3.928 I, [2022-09-19T19:23:11.119561 #1] INFO – : Writing /app/public/assets/notice-e348463c1fa5eabe612eb21ac03b550b5e9278df27b26dc21d745205c1fd9bee.png
#26 3.928 I, [2022-09-19T19:23:11.119813 #1] INFO – : Writing /app/public/assets/progress-4401130d700faadafe42bf322264e2689dae9ded22c1186c38ad2699d28b9715.gif
#26 3.928 I, [2022-09-19T19:23:11.120129 #1] INFO – : Writing /app/public/assets/success-abc60b9ec6e86a3254ee885da0f04a6d2b9c68e044ee5976710d7b8bf8fdddc3.png
#26 3.929 I, [2022-09-19T19:23:11.120378 #1] INFO – : Writing /app/public/assets/warning-c8acc23f866cdb032492373cc343f0121f867e0eb28f5efe1c0b0de71371133c.png
#26 3.929 I, [2022-09-19T19:23:11.120605 #1] INFO – : Writing /app/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js
#26 3.929 I, [2022-09-19T19:23:11.120757 #1] INFO – : Writing /app/public/assets/manifest-b4bf6e57a53c2bdb55b8998cc94cd00883793c1c37c5e5aea3ef6749b4f6d92b.js.gz
#26 3.929 I, [2022-09-19T19:23:11.120959 #1] INFO – : Writing /app/public/assets/favicon-99f7ffd3b4b4f5f0dc6803372c4e1f1a3347e305d56651e29879f5a66c622f5a.ico
#26 3.931 I, [2022-09-19T19:23:11.122137 #1] INFO – : Writing /app/public/assets/favicon-99f7ffd3b4b4f5f0dc6803372c4e1f1a3347e305d56651e29879f5a66c622f5a.ico.gz
#26 3.931 I, [2022-09-19T19:23:11.122682 #1] INFO – : Writing /app/public/assets/programmer-e0e84c7fb09cf1e99f4639229eac577fd631a4c88f1074f73f6769382f7a8849.jpg
#26 3.932 I, [2022-09-19T19:23:11.123141 #1] INFO – : Writing /app/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#26 3.932 I, [2022-09-19T19:23:11.123516 #1] INFO – : Writing /app/public/assets/application-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#26 3.932 I, [2022-09-19T19:23:11.123809 #1] INFO – : Writing /app/public/assets/contacts-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#26 3.932 I, [2022-09-19T19:23:11.124060 #1] INFO – : Writing /app/public/assets/contacts-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#26 3.933 I, [2022-09-19T19:23:11.124314 #1] INFO – : Writing /app/public/assets/portfolio-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css
#26 3.933 I, [2022-09-19T19:23:11.124519 #1] INFO – : Writing /app/public/assets/portfolio-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.css.gz
#26 3.957 Volta error: Yarn is not available.
#26 3.957
#26 3.957 Use volta install yarn to select a default version (see volta help install for more info).
#26 3.959 Yarn not installed. Please download and install Yarn from Installation | Yarn
#26 3.959 Exiting!


Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -o pipefail -c ${BUILD_COMMAND}]: exit code: 1

Any help would be appreciated.
Mike

Make a one line fix to your Dockerfile and you should be up and running.

Before:

RUN volta install node@${NODE_VERSION}

After:

RUN volta install node@${NODE_VERSION} yarn

I’ll fix flyctl to generate a correct Dockerfile handing this case going forward.

1 Like

I am having a similar issue, but my docker file already got suggested values:

Error code:

#25 26.16 I, [2022-12-12T20:44:56.862740 #1]  INFO -- : Writing /app/public/assets/rails_admin/fa-solid-900-33e728329ea58ca0ddc5f1002bb9a744a02d5679b12103ca30373e687aed1698.svg
#25 26.16 I, [2022-12-12T20:44:56.863556 #1]  INFO -- : Writing /app/public/assets/rails_admin/fa-solid-900-33e728329ea58ca0ddc5f1002bb9a744a02d5679b12103ca30373e687aed1698.svg.gz
#25 26.66 Compiling...
#25 28.83 Compilation failed:
#25 28.83 Internal Error: tripr-web@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile
#25 28.83     at pQ.getCandidates (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:435:5146)
#25 28.83     at Wf.getCandidates (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:391:1264)
#25 28.83     at /root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:439:7695
#25 28.83     at Rf (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:390:8965)
#25 28.83     at ge (/root/.volta/tools/image/yarn/3.3.0/bin/yarn.js:439:7675)
#25 28.83
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -o pipefail -c ${BUILD_COMMAND}]: exit code: 1

Docker file:

RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH $VOLTA_HOME/bin:/usr/local/bin:$PATH
RUN volta install node@${NODE_VERSION} yarn@${YARN_VERSION} && \
    gem update --system --no-document && \
    gem install -N bundler -v ${BUNDLER_VERSION}

any work arounds?

Already tried to remove the yarn file!