キリンめも(技術)

記事を書いています #rails #swift #JS #UE4 #unity

Bash on WindowsでRailsの環境構築してはまったところ。

以下のサイトを参考にして構築しました。
windowsのbashでRails環境を構築してみる。(Windows 10 Anniversary Update版) - Qiita


デフォルトの状態でgit >rbenv >rubyの順番で試したが、うまくいかず私の場合作業用フォルダを作成してその中でgit >rbenv> rubyの順番で導入しました。



Bundle install できない問題

原因  ローカルではなくグローバルのrubyを使っているから
最新のrubyをダウンロードしたはず、、

$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-linux]
$ rbenv exec gem install bundler
   Fetching: bundler-1.10.3.gem (100%)
   Successfully installed bundler-1.10.3
   Parsing documentation for bundler-1.10.3
   Installing ri documentation for bundler-1.10.3
   1 gem installed
$ rbenv rehash # 忘れずに!
$ which bundle
   ~/.rbenv/shims/bundle

$ bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/..
Using rake 10.3.2
...(中略)...
Using bundler 1.10.3
Bundle complete! 15 Gemfile dependencies, 45 gems now installed.
Bundled gems are installed into ./vendor/bundle.

bundle install しようとしたら ruby のバージョン違くてコケた話 - Qiita

DBがないと言われる

$bin/rails db:migrate

下のようにでたらおk

== 20170515162447 CreateUsers: migrating ======================================
create_table(:users)
== 20170515162447 CreateUsers: migrated (0.0019s) =============================

Railsの起動にはまる

rails aborted!
Errno::EINVAL: Invalid argument - Failed to watch "/home/nishioka/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/locale": the given event mask contains no legal events; or fd is not an inotify file descriptor.
/home/nishioka/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/watcher.rb:74:in `initialize'
/home/nishioka/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:190:in `new'

以下を記入

config/environments/development.rb
#config.file_watcher = ActiveSupport::EventedFileUpdateChecker
 以下を追加
  config.file_watcher = ActiveSupport::FileUpdateChecker

Rails serverが失敗する

Gem fileの以下のコメントをはずす
gem 'therubyracer', platforms: :ruby

再度bundle installをしてrails s をする

Bash on WindowsでRails開発 - Qiita