[RUBY] Beginners use ubuntu in windows to prepare rails environment

Introduction

I'm a beginner and what is WSL? ?? It was a level that started from, but I managed to prepare the environment so I will leave it as a memorandum for latecomers This time, the goal was to prepare the rails environment using WSL called ubuntu. The errors that were difficult for me as a beginner are as follows.

Suddenly stumbled with rbenv install 2.7.0

Since I don't know right or left, I investigated the installation method and arrived at the following site. https://railsgirls.jp/install#setup_for_windows_without_wsl Since step 1 was only installation, I proceeded quickly, and while I was wondering if the environment maintenance would be completed soon, I stumbled on the 4th step of step 2. Specifically

rbenv install 2.7.0

I stumbled on it. INSTALL FILLED is displayed and you can see that an error-like event has occurred. As I investigated, I found that the package was missing, and when I ran the following code, I was able to solve it.

sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn

Stumble on rails server

I had a hard time overcoming rbenv install 2.7.0 and rails, and I thought it would end, but life doesn't go well. The goal was just around the corner, but an error appeared on the screen again. I can't find the webpacker. Therefore

rails webpacker install

I get an error again when I run. .. ..

bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)

Something is wrong with the file to install rails webpacker install. Then, when I investigated further, it was said that it was necessary to install it with something called yarn installed.

# Node.install js
sudo apt install -y nodejs npm
sudo npm install n -g
sudo n stable
sudo apt purge -y nodejs npm
exec $SHELL -l
#install yarn
rails yarn install
#install webpacker
rails webpacker install

The error could be resolved by

Finally

It seems easy to write so far, but it takes a week to solve these two problems. How difficult it was for a beginner who didn't know anything to understand and find out what was required from the error statement and enter the appropriate command. .. .. I would like to continue to improve my problem-solving ability by learning from this error. .. ..

Recommended Posts

Beginners use ubuntu in windows to prepare rails environment
[Rails] How to use PostgreSQL in Vagrant environment
How to use custom helpers in rails
Use docker in proxy environment on ubuntu 20.04.1
How to use MySQL in Rails tutorial
How to use environment variables in RubyOnRails
How to use credentials.yml.enc introduced in Rails 5.2
[Environment construction] Rails + MySQL + Docker (Beginners can also use it in 30 minutes!)
[Rails] How to use select boxes in Ransack
How to use JQuery in js.erb of Rails6
I want to use a little icon in Rails
Command memo to install xeyes in ubuntu docker environment
Cross-compile Qt – GUI Windows Application in Ubuntu 18.04 MinGW environment
For those who want to use MySQL for the database in the environment construction of Rails6 ~.
Rails6 (MySQL, Ubuntu environment, Cloud9)
[Rails] How to use enum
[Rails] How to use enum
How to use rails join
[Rails] How to use validation
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
Use multiple checkboxes in Rails6!
Ubuntu unable to log in
[Rails] How to use Scope
Difficulties in building a Ruby on Rails environment (Windows 10) (SQLite3)
Use Java Web Start in an OpenJDK environment on Windows
How to use Ubuntu Server 20.10 (Groovy Gorilla) in Sakura's cloud
[Rails] How to use gem "devise"
How to use Lombok in Spring
[Windows] WSL2 + Ubuntu + Node.js environment construction
[Rails] How to use flash messages
[Rails] How to execute "rails db: create" etc. in production environment EC2
Rails (postgeresql. Ubuntu environment), heroku deployment
[Rails] How to write in Japanese
How to use Ruby on Rails
I tried setting Java beginners to use shortcut keys in eclipse
[Rails] Use cookies in API mode
How to use Bio-Formats on Ubuntu 20.04
How to use InjectorHolder in OpenAM
How to install the language used in Ubuntu and how to build the environment
[Rails] How to use Active Storage
How to use classes in Java?
[Rails 6] Customize Bootstrap in Rails + Bootstrap 5.0.0-alpha environment
Troublesome Rails environment construction flow [Windows 10]
Address already in use workaround (Windows)
[Rails] How to reset the database in production environment (Capistrano version)
How to install Swiper in Rails
Use Timecop in Rails web app to travel time on your browser
How to build a Ruby on Rails environment using Docker (for Docker beginners)
[Rails] Use devise to get information about the currently logged in user
[Error] Switch environment construction to use Ruby on Rails oss (open source)
[For Rails beginners] Summary of how to use RSpec (get an overview)
How to implement search functionality in Rails
Multilingual Locale in Java How to use Locale
WSL2 + Ubuntu 20.04 Install Vivado in LTS environment
How to change app name in rails
[Ruby on Rails] How to use CarrierWave
[Docker] Use environment variables in Nginx conf
How to use named volume in docker-compose.yml
[Rails] How to use rails console with docker
[Docker] Building an environment to use Hugo