#つまずいている事
下記の記事を参考にWebpackerを使用してRailsにVue.jsを導入しました。
その後rails g controllerした際に下記の'yarn'と'ActiveRecord'に関するエラーが発生して躓いております。。
参考URL:https://qiita.com/jnchito/items/30ab14ebf29b945559f6
#環境
ruby 2.6.0p0
Rails 5.1.6.2
vue@2.6.10
yarn 1.15.2
#エラーログ
command
1ユーザー:~/environment/vue.js-tutorial (master) $ rails g controller Home index 2warning Skipping preferred cache folder "/home/ec2-user/.cache/yarn" because it is not writable. 3warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-501". 4/home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.1.6.2/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError) 5 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.1.6.2/lib/active_record/connection_adapters/connection_specification.rb:185:in `spec' 6 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.1.6.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `establish_connection' 7 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.1.6.2/lib/active_record/connection_handling.rb:58:in `establish_connection' 8 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.1.6.2/lib/active_record/railtie.rb:124:in `block (2 levels) in <class:Railtie>' 9 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval' 10 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook' 11 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control' 12 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook' 13 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks' 14 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:49:in `each' 15 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks' 16 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.1.6.2/lib/active_record/base.rb:326:in `<module:ActiveRecord>' 17 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activerecord-5.1.6.2/lib/active_record/base.rb:25:in `<top (required)>' 18 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:292:in `require' 19 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:292:in `block in require' 20 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:258:in `load_dependency' 21 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:292:in `require' 22 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application.rb:356:in `active_record_configured?' 23 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application.rb:273:in `disconnect_database' 24 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application.rb:107:in `preload' 25 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve' 26 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run' 27 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop' 28 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run' 29 from /home/ec2-user/.rvm/gems/ruby-2.6.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>' 30 from /home/ec2-user/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 31 from /home/ec2-user/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' 32 from -e:1:in `<main>'
#エラーへの対処
①エラーをググってみた
→効果的な解決策がヒットせず。
②ActiveRecordに関するエラーについて
→すでにSqlite3がインストール済みであることを確認。(Gemfileは以下。)
#Gemgile
ruby
1source 'https://rubygems.org' 2 3git_source(:github) do |repo_name| 4 repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") 5 "https://github.com/#{repo_name}.git" 6end 7 8 9# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 10gem 'rails', '~> 5.1.6' 11# Use sqlite3 as the database for Active Record 12gem 'sqlite3' 13# Use Puma as the app server 14gem 'puma', '~> 3.7' 15# Use SCSS for stylesheets 16gem 'sass-rails', '~> 5.0' 17# Use Uglifier as compressor for JavaScript assets 18gem 'uglifier', '>= 1.3.0' 19# See https://github.com/rails/execjs#readme for more supported runtimes 20# gem 'therubyracer', platforms: :ruby 21 22# Use CoffeeScript for .coffee assets and views 23gem 'coffee-rails', '~> 4.2' 24# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 25gem 'turbolinks', '~> 5' 26# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 27gem 'jbuilder', '~> 2.5' 28# Use Redis adapter to run Action Cable in production 29# gem 'redis', '~> 4.0' 30# Use ActiveModel has_secure_password 31# gem 'bcrypt', '~> 3.1.7' 32 33# Use Capistrano for deployment 34# gem 'capistrano-rails', group: :development 35 36 37group :development, :test do 38 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 39 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 40 # Adds support for Capybara system testing and selenium driver 41 gem 'capybara', '~> 2.13' 42 gem 'selenium-webdriver' 43end 44 45group :development do 46 # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 47 gem 'web-console', '>= 3.3.0' 48 gem 'listen', '>= 3.0.5', '< 3.2' 49 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 50 gem 'spring' 51 gem 'spring-watcher-listen', '~> 2.0.0' 52end 53 54# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 55gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 56 57gem 'webpacker', github: 'rails/webpacker'
#追記:bundle installの結果
piyota08:~/environment/vue.js-tutorial (master) $ bundle The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Using rake 12.3.2 Using concurrent-ruby 1.1.5 Using i18n 1.6.0 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.1.6.2 Using builder 3.2.3 Using erubi 1.8.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.1 Using rails-dom-testing 2.0.3 Using crass 1.0.4 Using loofah 2.2.3 Using rails-html-sanitizer 1.0.4 Using actionview 5.1.6.2 Using rack 2.0.6 Using rack-test 1.1.0 Using actionpack 5.1.6.2 Using nio4r 2.3.1 Using websocket-extensions 0.1.3 Using websocket-driver 0.6.5 Using actioncable 5.1.6.2 Using globalid 0.4.2 Using activejob 5.1.6.2 Using mini_mime 1.0.1 Using mail 2.7.1 Using actionmailer 5.1.6.2 Using activemodel 5.1.6.2 Using arel 8.0.0 Using activerecord 5.1.6.2 Using public_suffix 3.0.3 Using addressable 2.6.0 Using bindex 0.5.0 Using bundler 1.17.2 Using byebug 11.0.1 Using xpath 3.2.0 Using capybara 2.18.0 Using ffi 1.10.0 Using childprocess 0.9.0 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 0.20.3 Using railties 5.1.6.2 Using coffee-rails 4.2.2 Using multi_json 1.13.1 Using jbuilder 2.8.0 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.0 Using ruby_dep 1.5.0 Using listen 3.1.5 Using puma 3.12.1 Using rack-proxy 0.6.5 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.1.6.2 Using rubyzip 1.2.2 Using sass-listen 4.0.0 Using sass 3.7.3 Using tilt 2.0.9 Using sass-rails 5.0.7 Using selenium-webdriver 3.141.0 Using spring 2.0.2 Using spring-watcher-listen 2.0.1 Using sqlite3 1.4.0 Using turbolinks-source 5.2.0 Using turbolinks 5.2.0 Using uglifier 4.1.20 Using web-console 3.7.0 Using webpacker 4.0.2 from https://github.com/rails/webpacker.git (at master@554221c) Bundle complete! 17 Gemfile dependencies, 72 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed.
#お願い
一人では解決が難しいため
どなたかアドバイスをよろしくお願いします。
以上です。
回答1件
あなたの回答
tips
プレビュー