简体   繁体   中英

LoadError: cannot load such file — mysql2/mysql2 - on rake db:create

When i run rake db:create , I get this error:

LoadError: cannot load such file -- mysql2/mysql2
/Users/vitorqueiroz/dev/pipeline/config/application.rb:10:in `<top (required)>'
/Users/vitorqueiroz/dev/pipeline/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

I had to mannualy install mysql2 gem because the gemfile specifies the version '0.3.20'

I ran gem install mysql2 -v '0.3.20' -- --srcdir=/usr/local/include/mysql

Bundle install runs fine, and says everything is installed.

bundle list mysql2 evaluates to:

/Users/vitorqueiroz/.rbenv/versions/2.3.6/lib/ruby/gems/2.3.0/gems/mysql2-0.3.20

--

Any alternatives?

You can try

bundle exec rake db:create

to be sure that bundled gems are loaded.

https://bundler.io/man/bundle-exec.1.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM