Ruby on Rails

Ruby on rails(루비온레일즈) 1강 : 윈도우에 설치하기

EasyCoding 2021. 1. 28. 14:20
728x90

 

Ruby on rails(루비온레일즈) 란?

생산성이 좋은 백엔드 프레임웍으로써 airbnb, 당근마켓등이 이걸로 개발됨.

 

우선 아래 사이트에 들어가서, 추천하는 버전을 다운로드하여서 설치하세요.

rubyinstaller.org/downloads/

 

Downloads

Which version to download? If you don’t know what version to install and you’re getting started with Ruby, we recommend that you use the Ruby+Devkit 2.7.X (x64) installer. It provides the biggest number of compatible gems and installs the MSYS2 Devkit

rubyinstaller.org

 

 

 

여기서 맨붕이 오는데, 잘 읽어보면, 잘 모르면 그냥 번호 없이 Enter 치라고 하네요.. 그래서 그냥 Enter 치구, 설치 완료되면 또 그냥 Enter 치면 끝남.

설치 끝나고 도스창 열어서 아래 같이 버전 확인하고 

gem list 로 확인하고

그다음, Rails 인스톨

gem install rails --no-document

 

그다음 bundler (packaging program)와 rails 버전 확인하면 이상하게도 bundler 버전이 다름

 

mkdir rails_apps

cd rails_apps

rails new webapp

하면 yarn 이 없다고 해서

npm install -g yarn

로 먼저 깔고 다시 실행

하면 아래 처럼 성공함.

 

저는  sqlite3 없다는 에라가 안 뜨는데, 만일 뜨는 분은 

github.com/sparklemotion/sqlite3-ruby/issues/224

 

cannot load such file -- sqlite3 (LoadError) · Issue #224 · sparklemotion/sqlite3-ruby

Can you help? I'm new to development on Ruby. I tried to use SQLite in my app ( require 'sqlite3' ) and : main.rb:5:in `require': cannot load such file -- sqlite3 (LoadError) from m...

github.com

이 가서 보면

gemfile 열고 sqlite3 옆에 gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"를 붙이라고 하네요

 

larskanis/sqlite3-ruby

Ruby bindings for the SQLite3 embedded database. Contribute to larskanis/sqlite3-ruby development by creating an account on GitHub.

github.com

 

그다음

bundle install이라고 쳐보면 맨 아래처럼 sqllite3 가 들어가 있는 게 보입니다

 

 

자, 이제 실행을 해 볼까요

webapp 상에서 rails s 또는 rails server 라고 치면

 

localhost:3000에 접속하면 끝