I'm having problems with libv8 when running rails server on Mac M2 ventura - ruby-on-rails

I had some problems installing ruby ​​2.6.6 in my terminal, and one of them was with libv8 and therubyracer. I was able to solve the problem by installing rosetta 2 and installing the gems as follows
alias ibrew="arch -arm64 brew"
export PATH="/usr/local/homebrew/bin:$PATH"
gem install libv8 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=$(ibrew --prefix v8#3.15)
bundle
But after the bundle ran correctly, another problem appeared that I couldn't solve...
/Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8.rb:4:in `require': dlopen(/Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8/init.bundle, 0x0009): symbol not found in flat namespace '__ZN2v810ScriptData10PreCompileEPKci' - /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8/init.bundle (LoadError)
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/v8.rb:4:in `<top (required)>'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/therubyracer.rb:1:in `require'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/therubyracer-0.12.3/lib/therubyracer.rb:1:in `<top (required)>'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `require'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `each'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:76:in `block in require'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `each'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/runtime.rb:65:in `require'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler.rb:114:in `require'
from /Users/my_user/projetos/autocommerce/config/application.rb:18:in `<top (required)>'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/command/actions.rb:22:in `require'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/command/actions.rb:22:in `require_application!'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/commands/console/console_command.rb:95:in `perform'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/command/base.rb:69:in `perform'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/command.rb:46:in `invoke'
from /Users/my_user/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/railties-5.2.5/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I tried reinstall the gems and the project but nothing works...

Related

Error while running bundle install and rails server command

Whenever I try to run the above mention command it shows the following error.
This is the first step when i try to run the simple bundle command: Bundle install
/home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/digest.rb:16:in `const_missing': library not found for class Digest::MD5 -- digest/md5 (LoadError)
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/source/rubygems/remote.rb:26:in `cache_slug'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/fetcher/compact_index.rb:107:in `cache_path'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/fetcher/compact_index.rb:83:in `compact_index_client'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:646:in `warn_on_outdated_bundler'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:24:in `block in dispatch'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor.rb:366:in `dispatch'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:22:in `dispatch'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:13:in `start'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/exe/bundle:30:in `block in <top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/exe/bundle:22:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/bin/bundle:22:in `load'
from /home/mifi/.rbenv/versions/2.4.0/bin/bundle:22:in `<main>'
And when i found the above error i try to run the server command for the rails but it doesn't work out for me.
rails server
/home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': libcrypto.so.1.0.2: cannot open shared object file: No such file or directory - /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-linux/digest/sha1.so (LoadError)
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/source/git.rb:4:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/lockfile_parser.rb:122:in `<class:LockfileParser>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/lockfile_parser.rb:14:in `<module:Bundler>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/lockfile_parser.rb:13:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/definition.rb:2:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler.rb:129:in `definition'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler.rb:95:in `setup'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/setup.rb:9:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/mifi/huginn/config/boot.rb:6:in `<top (required)>'
from bin/rails:8:in `require_relative'
from bin/rails:8:in `<main>'
and same for the rails -v command:
/home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require': libcrypto.so.1.0.2: cannot open shared object file: No such file or directory - /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-linux/digest/md5.so (LoadError)
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/generators/app_base.rb:2:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/generators/rails/app/app_generator.rb:1:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/application/application_command.rb:2:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/behavior.rb:82:in `block (2 levels) in lookup'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/behavior.rb:78:in `each'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/behavior.rb:78:in `block in lookup'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/behavior.rb:77:in `each'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/behavior.rb:77:in `lookup'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:68:in `find_by_namespace'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:42:in `invoke'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/cli.rb:16:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /home/mifi/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/exe/rails:9:in `<top (required)>'
from /home/mifi/.rbenv/versions/2.4.0/bin/rails:22:in `load'
from /home/mifi/.rbenv/versions/2.4.0/bin/rails:22:in `<main>'
Is there anything I am missing out.
I got this same error, and it seems like that version of ruby got corrupted.
> bundle install
~/.rbenv/versions/2.5.6/lib/ruby/2.5.0/digest.rb:16:in `const_missing':
library not found for class Digest::SHA1 -- digest/sha1 (LoadError)
> ruby -r digest/sha1 -e 'p Digest::MD5'
...
Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
...
Using a mac with rbenv, I fixed it as follows:
> ruby -v
ruby 2.5.6p201 (2019-08-28 revision 67796) [x86_64-darwin18]
> rbenv install 2.5.6
...
continue with installation? (y/N) y
...
Installed ruby-2.5.6 to ~/.rbenv/versions/2.5.6
> ruby -r digest/sha1 -e 'p Digest::MD5'
Digest::MD5
bundle install worked after that.
Note: I got a lot of messages about running gem pristine, so just in case, I also ran:
> gem pristine --all
One of your underlying libraries is not installed. Run
sudo apt-get install libssl-dev libssl
Assuming you are on ubuntu linux.

Gem install error (gem install sass)

I am using my root account for terminal:
I installed ruby (yum install ruby), and when tryng to install sass or other gems it gives me this error:
[root#ve555 /]# ruby -v
ruby 2.0.0p598 (2014-11-13) [x86_64-linux]
[root#ve555 /]# gem install sass
Successfully installed sass-3.4.22
/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- json/pure (LoadError)
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/gems/gems/json-1.7.7/lib/json.rb:60:in `rescue in <module:JSON>'
from /usr/share/gems/gems/json-1.7.7/lib/json.rb:57:in `<module:JSON>'
from /usr/share/gems/gems/json-1.7.7/lib/json.rb:54:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/text.rb:16:in `<top (required)>'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/code_object.rb:28:in `<class:CodeObject>'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/code_object.rb:26:in `<top (required)>'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/generator/markup.rb:59:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/generator/darkfish.rb:6:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rdoc.rb:563:in `<top (required)>'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:64:in `load_rdoc'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:229:in `setup'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:142:in `generate'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:54:in `block in generation_hook'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:53:in `each'
from /usr/share/gems/gems/rdoc-4.0.0/lib/rdoc/rubygems_hook.rb:53:in `generation_hook'
from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:189:in `call'
from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:189:in `block in install'
from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:188:in `each'
from /usr/local/share/ruby/site_ruby/rubygems/request_set.rb:188:in `install'
from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:205:in `install_gem'
from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:255:in `block in install_gems'
from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:251:in `each'
from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:251:in `install_gems'
from /usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:158:in `execute'
from /usr/local/share/ruby/site_ruby/rubygems/command.rb:310:in `invoke_with_build_args'
from /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:169:in `process_args'
from /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:139:in `run'
from /usr/local/share/ruby/site_ruby/rubygems/gem_runner.rb:55:in `run'
from /usr/bin/gem:21:in `<main>'
Can someone help me to fix this?
Have you tried: gem install json_pure before gem install sass ?
(This supposed to be in comment section, but my reputation is insufficient)

`require': cannot load such file -- ffi (LoadError) `require': cannot load such file -- ffi (LoadError) when trying to start rails console

Full stack trace:
/Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- ffi (LoadError)
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/sys-proctable-1.1.1-universal-darwin/lib/darwin/sys/proctable.rb:2:in `<top (required)>'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/sys-proctable-1.1.1-universal-darwin/lib/sys-proctable.rb:1:in `<top (required)>'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from /Users/galharth/Documents/productbattle/config/application.rb:7:in `<top (required)>'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:141:in `require'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:141:in `require_application_and_environment!'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:67:in `console'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/galharth/.rvm/gems/ruby-2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Rails version: 4.2.5
Ruby version: 2.3.0
Bundler version: 1.10.6
OSX: El Capitan (Co-worker using windows)
Try running gem install ffi --platform=ruby.
See this issue for more insight and resolution options.
I was able to successfully install the ffi gem by running gem install ffi --platform=ruby, adding the line gem 'ffi' to my Gemfile, and then running bundle install`.

rails server error on ubuntu

I am following ruby on rails getting started guide ( http://guides.rubyonrails.org/getting_started.html )
I installed ruby and rails as it is suggested in the guide but when I try to execute:
bin/rails server
I see the following error in the terminal:
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
/var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /var/lib/gems/2.1.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /home/soroosh/rails/blog/config/application.rb:7:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:78:in `require'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /var/lib/gems/2.1.0/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'
from /home/soroosh/rails/blog/bin/rails:9:in `require'
from /home/soroosh/rails/blog/bin/rails:9:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client/rails.rb:28:in `load'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client/rails.rb:28:in `call'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client/command.rb:7:in `call'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/client.rb:28:in `run'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/bin/spring:49:in `<top (required)>'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/binstub.rb:11:in `load'
from /var/lib/gems/2.1.0/gems/spring-1.6.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/soroosh/rails/blog/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
I am using ubuntu 15.10 , ruby 2.1 and rails4.2.5.1
If you look closely at the error message, this is the important line:
There was an error while trying to load the gem 'uglifier'.
Uglifier is a Javascript wrapper, so it will need a Javascript interpreter. I recommend installing NodeJS:
sudo apt-get install nodejs
read more about uglifier: https://github.com/lautis/uglifier

Cannot start WEBrick server. Mysql2 `require': cannot load such file

I have installed a fresh install of Ruby / Rails on an clean Windows 8 install and amy getting errors when trying to start the WEBrick server. Have searched for an answer but cant find one.
Error as below:
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.2/mysql2 (LoadError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/mysql2-0.3.18-x64-mingw32/lib/mysql2.rb:31:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler.rb:134:in `require'
from C:/Users/Brendon/Sites/quote/config/application.rb:7:in `<top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Any help greatly appreciated
You need to use bundler to install the gem first.
Either do:
gem install mysql2
or
cd /my/rails/project && bundle install
note: the mysql2 gem is a [expletive] to install... best of luck

Resources