Install Webpacker and Yarn to run Rails

environment

Ubuntu16.04.7 LTS Windows10 + Vegrant Rails 6.0.3

What i did

When I started rails, Webpacker exists, so I got an error message to install it, so I decided to install it.

$ rails s
Webpacker configuration file not found /vagrant/xxx/config/webpacker.yml. 
Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /vagrant/xxx/config/webpacker.yml (RuntimeError)

However, when I try to install Webpacker, it asks me to install Yarn this time.

$rails webpacker:install
Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/

For the installation method of Yarn, refer to the basic and official website. https://classic.yarnpkg.com/en/docs/install/#debian-stable

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

** Command description ** --apt-key is a command to add a new key to an existing key list. With --add-, it means to add to the key list from standard input. --tee is a command that writes standard output to a file and also displays it on the screen. --The URL of yarn's remote repository is written to yarn.list. --stable main is the stable version.

Use update to update the package index file before installing. It is a promise to update before installing the package.

$sudo apt update && sudo apt install yarn

** Command description ** Command 1 && Command 2 means that if command 1 completes successfully, command 2 will be executed.

Make sure Yarn is installed.

$yarn --version
1.22.5

rails s now works correctly.

$ rails s

Recommended Posts

Install Webpacker and Yarn to run Rails
Please run `yarn install --check-files` to update.
[Webpacker] Summary of how to install Bootstrap and jQuery in Rails 6.0
[Rails] How to install devise
[Rails] How to install simple_calendar
[Rails] How to install reCAPTCHA
[Docker] dokcer-compose run, Please run `yarn install –check-files` to update. Error
How to run React and Rails on the same server
[Rails] How to install Font Awesome
Rails new fails to install mysql
[Ruby on Rails] yarn install --check-files
[Rails] How to install ImageMagick (RMajick)
[Rails] How to install Font Awesome
Challenge to install WSL2 and docker
How to install Swiper in Rails
Install Ubuntu20.04 on RaspberryPi 4 and build Kubernetes to run the container
[Rails] [Memo] When to add = to <%%> and when not
(For beginners) [Rails] Time saving tech! How to install and use slim
Rails and FormData
How to build API with GraphQL and Rails
Reference articles and books used to install CentOS
[Ruby on Rails] How to install Bootstrap in Rails
[Rails] How to get success and error messages
Rails scope anti-patterns and how to eliminate them
[Rails] I want to load CSS with webpacker
Run Rubocop and RSpec on CircleCI and deploy to ECS
Change date and time to Japanese notation in Rails
[Rails] How to edit and customize devise view and controller
[Rails] Create sitemap using sitemap_generator and deploy to GAE
Addicted to the webpacker that comes standard with Rails 6
How to install Gradle and Kotlin with SDKMAN (Mac)
(Ruby on Rails6) How to create models and tables
[Rails] How to install a decorator using gem draper
Try to implement tagging function using rails and js
Rails valid? And invalid?
How to write Rails
Introducing CircleCI to Rails
Introducing Bootstrap to Rails 5
Introducing Bootstrap to Rails !!
Test run on rails
Introduce Vue.js to Rails
Install and configure Keycloak
Mac Rails Install Error
How to install Docker
How to uninstall Rails
How to install docker-machine
When I set webpack.config.js to run vue.js on rails6, I got too many errors and grass
How to install MySQL
Install buildah and container-selinux
How to install ngrok
[Rails] What is the difference between bundle install and bundle update?
(For myself) Allow jupyterlab to run various languages ​​and C #
Implementation policy to dynamically save and display Timezone in Rails
How to Install Elixir and Phoenix Framework on Ubuntu 20.04 LTS
[Rails] How to define macros in Rspec and standardize processing
[Rails] Differences between redirect_to and render methods and how to output render methods
How to run npm install on all projects in Lerna
[Rails] Function to search and list products from multi-level categories
How to set and describe environment variables using Rails zsh
How to deploy jQuery in your Rails app using Webpacker
Super easy in 2 steps! How to install devise! !! (rails 5 version)