Ruby on Rails Tutorialをやってみた。

cloud9は使用せずにローカルにvagrant で環境作成してチャレンジ。
bundle installするとエラー。
Bundler could not find compatible versions for gem “activesupport”:
In snapshot (Gemfile.lock):
activesupport (= 5.1.6)In Gemfile:
rails (= 5.1.4) was resolved to 5.1.4, which depends on
activesupport (= 5.1.4)coffee-rails (= 4.2.2) was resolved to 4.2.2, which depends on
railties (>= 4.0.0) was resolved to 5.1.6, which depends on
activesupport (= 5.1.6)Running `bundle update` will rebuild your snapshot from scr
bundle updateしてとあるので、実行
リスト 1.5: Ruby gemごとにバージョンを明示的に指定したGemfileでエラーがおきる
$ rails server
/home/vagrant/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require’: There was an error while trying to load the gem ‘uglifier’. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
GitHubのexecjsページにあるインストール可能なランタイム
gem install execjs
を実行。するがエラー解消せず。
Gemfileにgem ‘therubyracer’という記述を追加して、bundle update以降の手順を同様に実行するとよいらしいので、
Gemfileに追加
gem ‘jbuilder’, ‘2.6.4’
gem ‘therubyracer’
group :development, :test do
して、bundle update
rails server
を起動した。
therubyracerって
参考)https://note.mu/konpyu/n/na213a14ad1e3
RubyからJavaScriptを叩ける必要があるらしい。mini_racerというものが主流になっているそうだ。
$ git remote add origin git@bitbucket.org:ユーザー名/hello_app.git
$ git push -u origin –all
でこける
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
アクセス権でおこられる。
会社用、個人用に分けたかったので、configファイルで分けて設定。うまくいっていたけど、途中からpushできなくなった。
インストールしてあるsourceTreeの環境設定からアカウントをいろいろ編集するが、解決できず。
20分くらいして試すとpushできるようになった。不思議。。
コメント