[RAILS] What to do if you get angry with "ERROR: There are no scenarios; must have at least one" even though you should have entered yarn in Docker

background

I should have put yarn in Docker, but when I hit the command below, I got angry

Contents of Dockerfile

FROM ruby:2.5
RUN apt-get update && apt-get install -y \
    build-essential \
    libpq-dev \
    nodejs \
    postgresql-client \
    yarn
WORKDIR /kosare
COPY Gemfile Gemfile.lock /kosare/
RUN bundle install

Error occurred in yarn command

[email protected]:/kosare# yarn -v
ERROR: There are no scenarios; must have at least one.

Solution (temporary solution)

Basically, if you do the same as the URL described in the reference, it will be solved. In my case, it was already entered as root, so I removed the part that says sudo and executed it in order to solve it.

Delete old yarn

sudo apt remove cmdtest
sudo apt remove yarn

Get the latest

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -

Get the latest

echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

update

apt-get update 

re-install

apt-get install yarn

Version confirmation

yarn -v

Solution (fundamental solution)

With the above method, the same thing happens again when bundle install is done again with docker. I want to solve it when building with Dockerfile, so add the following two lines to dockerfile.

RUN curl https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

Dockerfile (final form)

FROM ruby:2.5
RUN curl https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y \
    build-essential \
    libpq-dev \
    nodejs \
    postgresql-client \
    yarn
WORKDIR /kosare
COPY Gemfile Gemfile.lock /kosare/
RUN bundle install

If you rebuild it with this, yarn should be usable properly.

reference

https://k-koh.hatenablog.com/entry/2020/04/02/143017 https://github.com/yarnpkg/yarn/issues/7329 https://qiita.com/MasatoraAtarashi/items/3f0317cd648ff63fa92c

Recommended Posts

What to do if you get angry with "ERROR: There are no scenarios; must have at least one" even though you should have entered yarn in Docker
What to do if you get a gcc error in Docker
What to do if you get a DISPLAY error in gym.render ()
What to do if you get angry with OpenSSL with pyenv install
What to do if you get a "Mysql2 :: Error: Operand should contain 1 column (s)" error in Rails
What to do if you get an [An HTTP request took too long to complete.] Error in Docker.
What to do if you get an error with bundle install by entering gem'bcrypt' in your Gemfile
What to do if you should have installed Rails but an error occurs with rails -v (for beginners)
What to do if you get the error Too long with no output (exceeded 10m0s) on CircleCI
What to do if you get angry if you don't have nokogiri while installing wp2txt
What to do if you have enabled Use the WSL2 based engine in Docker Desktop with insufficient WSL2 installation
What to do if you get a wrong number of arguments error in binding.pry
[Java] What to do if you get an error in Eclipse saying "Not allowed at source level below 1.X"
What to do if you get a java.io.IOException in GlassFish
[Rails] What to do if you can't get an error message with the errors method
What to do if you get a "302" error in your controller unit test code in Rails
What to do if you get an error in Basic authentication during Rails test code
What to do if you get `rescue in block in modules_for_hoge': Missing hoge file hoge / hoge_hoge.rb (AbstractController :: Helpers :: MissingHogeError) in rails s even though the file is in the specified error location.
What to do if you get a JNI shared library error when trying to build in Eclipse
[Rails] What to do if you can't get parameters with form_with
What to do if you get a groovy warning in Thymeleaf Layout
What to do if you get an error during rails db: reset
What to do if you get an uninitialized constant Likes Controller error
What to do if you get an error when you hit Heroku logs
What to do if you are told "there is no main manifest attribute" when creating a jar file containing dependencies in a maven project
What to do if you get a SQLite3 :: BusyException: database is locked error
What to do if you get the error message unrecognized selector send to instance "***"
What to do if you get an error on heroku rake db: migrate
What to do if you get an Argument Error: wrong number of arguments (given 2, expected 0) in your RSpec test
What to do if you get an error saying "Please enter a valid value" when getting with Rails datetime_field
[Solution] What to do if you get a Docker error'ERROR: Cannot connect to the Docker daemon at unix: ///var/run/docker.sock. Is the docker daemon running?'
What to do if you get the warning "Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1." in Rails 6.0
What to do if you can't get the text of an element in Selenium
What to do if you get the error Couldn't find Item without an ID
What to do if you get a port error when docker-compose up on Mac
How to make a jar with old Hadoop (hadoop-core-0.20.2-cdh3u6) in Gradle: (What to do if you get Could not expand ZIP ..)
What to do if you don't see the test code error message in the terminal console
What to do if you change the Listen Address from the settings screen with Mattermost docker
What to do if you get a "Cannot Pull Container Error" when starting ECS ​​Fargate
If the custom validation method says "Argument Error: You need to supply at least one validation"
[Swift5] What to do if you want to commit files to github but there are too many
What to do if you get further occurrences of http header parsing errors will be logged at debug level. In tomcat 8.5.37
What to do if you get an error saying Cannot find a valid baseurl for repo when you use yum -y install docker in a udemy course using CentOS7
Rails: You need to supply at least one validation error