i have a problem when i did
bundle exec rails db:migrate
Any ideas on how to fix it?
I have no idea why _mysql_affected_rows is not found.
Help would be appreciated.
rails aborted!
LoadError: dlopen(/Users/myname/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.4/lib/mysql2/mysql2.bundle, 0x0009): symbol not found in flat namespace '_mysql_affected_rows' - /Users/myname/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/mysql2-0.5.4/lib/mysql2/mysql2.bundle
/Users/myname/Desktop/github/company/config/application.rb:9:in `<top (required)>'
/Users/myname/Desktop/github/company/Rakefile:4:in `require_relative'
/Users/myname/Desktop/github/company/Rakefile:4:in `<top (required)>'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
Related
I am trying to setup new project which is in rails 6. When I am trying to create DB by running rake db:create, it gives me below error. Here is the complete trace.
rake aborted!
LoadError: cannot load such file -- celluloid/current
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `block in require'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:291:in `load_dependency'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require'
/home/rakesh/workspace/config/application.rb:4:in `<top (required)>'
/home/rakesh/workspace/Rakefile:4:in `require_relative'
/home/rakesh/workspace/Rakefile:4:in `<top (required)>'
/home/rakesh/.rvm/gems/ruby-2.5.8/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/home/rakesh/.rvm/gems/ruby-2.5.8/bin/ruby_executable_hooks:24:in `eval'
/home/rakesh/.rvm/gems/ruby-2.5.8/bin/ruby_executable_hooks:24:in `<main>'
(See full trace by running task with --trace)
I have tried multiple things to resolve the issue. e.g. - updating "private_pub" gem and ruby version etc.Any help would be highly appreciated.
I am new to ruby on rails. I want to re-create a production setup on my local system for development purposes.I seem to have run into a problem during migration of database.
I am using Ubuntu 18.04 OS. I have installed mysql-server, ruby 2.3.2 , rails 5.0, libmysqld-dev and mysql2 gem successfully. I was able to create a database and import the SQL file for table creation. To do pending migration, I executed rake db:migrate. I am getting the following error.
rake aborted!NameError: uninitialized constant ActiveRecord::VERSION
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/action_dispatch/session/active_record_store.rb:151:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/active_record/session_store.rb:2:in `require'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/active_record/session_store.rb:2:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/activerecord/session_store.rb:1:in `require'
/home/raj/.rvm/gems/ruby-2.3.2/gems/activerecord-session_store-1.1.1/lib/activerecord/session_store.rb:1:in `<top (required)>'
/home/raj/IRIS/config/application.rb:7:in `<top (required)>'
/home/raj/IRIS/Rakefile:4:in `require'
/home/raj/IRIS/Rakefile:4:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `eval'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `<main>'
LoadError: cannot load such file -- activerecord-session_store
/home/raj/IRIS/config/application.rb:7:in `<top (required)>'
/home/raj/IRIS/Rakefile:4:in `require'
/home/raj/IRIS/Rakefile:4:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `eval'
/home/raj/.rvm/gems/ruby-2.3.2/bin/ruby_executable_hooks:24:in `<main>'
(See full trace by running task with --trace)
Regarding the error in active_record_store.rb line number 151, the code is as follows:
if ActiveRecord::VERSION::MAJOR == 4
require 'action_dispatch/session/legacy_support'
ActionDispatch::Session::ActiveRecordStore.send(:include, ActionDispatch::Session::LegacySupport)
end
During RVM installation rails latest version was also installed somehow. Removing all the gems and doing bundle install worked.
Try running the below mentioned command
gem install activerecord
Hope this helps.
Can you add this to the top of active_record_store.rb to see if it works?
require 'active_record/version'
When I am running rake db:create in my ruby on rails project it's giving me error LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
Here is full error
tps#tps-H81M-S1:~/sites/my_app$ rake db:create
rake aborted!
LoadError: incompatible library version - /home/tps/.rvm/gems/ruby- 2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/server.rb:15:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma- 3.6.0/lib/puma/server.rb:15:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `<top (required)>'
/home/tps/sites/my_app/config/application.rb:7:in `<top (required)>'
/home/tps/sites/my_app/Rakefile:4:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
Can anyone please help me?
Thanks in advance
Try this(version 3.6.0):
gem uninstall puma
and
bundle
or try this
gem pristine --all
or for specific gem
gem pristine puma
I have been following a video tutorial and the database is created, but when trying to follow the step by going to directory and entering rake: dbmigrate
I get an error.
Ians-MacBook-Pro:music_library iansherwood$ rake db migrate
rake aborted!
dlopen(/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require'
/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler.rb:128:in `require'
/Users/iansherwood/Sites/music_library/config/application.rb:7:in `<top (required)>'
/Users/iansherwood/Sites/music_library/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
Have you tried bundle exec rake db:migrate?
Another possibility is that you don't have my MySQL running.
The easiest way to check for that would be:
ps aux | grep mysql
If it isn't running and you installed MySQL through
homebrew (common video guide way to install it) then you can run mysql.server start.
The syntax should be: rake db:migrate, and not rake: dbmigrate or rake db migrate.
It looks like your colon use might be inconsistent. Remember to use:
rake db:migrate
http://guides.rubyonrails.org/command_line.html
Did you include "gem 'mysql2'" in your Gemfile?
When I type the rails server on terminal, I got the following error.
I don't know how to fix it. Is any one can give me a help?
And I also need a ruby on rails mac os x Lion installation tutorial.
:simple_cms benhuayang$ rails server
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require':
dlopen(/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from:
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found -
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/gems/bundler-1.0.21/lib/bundler.rb:122:in `require' from
/Users/benhuayang/Sites/simple_cms/config/application.rb:7:in `<top (required)>' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:53:in `require' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:53:in `block in ' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap' from
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>' from
script/rails:6:in `require' from
script/rails:6:in `<main>'
this is path for mysql
/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0/bin:/Users/benhuayang/.rvm/gems/ruby-1.9.3-p0#global/bin:/Users/benhuayang/.rvm/rubies/ruby-1.9.3-p0/bin:/Users/benhuayang/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
When I've run into this in the past, I've used the following solution.
In the terminal, run:
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib"
Then try running your rails server command in the root of your app. If it works, just put that same command into your ~/.profile so that it runs each time you enter the terminal.
Ryan's solution worked for me when I had the following error after running rake db:migrate, I figured posting it will help with the google search.
rake aborted!
dlopen(/Users/[USERNAME]/.rvm/gems/ruby-1.9.3-p286/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/[USERNAME]/.rvm/gems/ruby-1.9.3-p286/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/[USERNAME]/.rvm/gems/ruby-1.9.3-p286/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
(See full trace by running task with --trace)