I am trying make a API with Rails
Ruby version: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
Rails version: Rails 5.2.4.1
I added the devise gem to the gemfile and ran the bundle, without errors. When I tried to run $ rails generate devise: install, this error occurred:
/home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:122:in `ensure in preload': undefined method `application' for Rails:Module (NoMethodError)
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:126:in `preload'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /home/isaac/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
Try restarting the spring server by using the following commands:
bin/spring stop
bin/spring start
Related
After deploying my Rails 5 (Ruby 2.3.7) application with Capistrano, I try run on my 'current' folder (with no luck) this command:
bundle exec puma -e production -b unix:/home/deploy/my_app/shared/tmp/sockets/puma.sock"
I get the following error (note that I've set Ruby version to 2.3.7 in the Gemfile, but the error mentions 2.3.0)
bundler: failed to load command: puma (/home/deploy/my_app/shared/bundle/ruby/2.3.0/bin/puma)
Errno::ENOENT: No such file or directory - connect(2) for /home/deploy/my_app/shared/tmp/sockets/puma.sock
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:370:in `initialize'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:370:in `new'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:370:in `add_unix_listener'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:141:in `block in parse'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:88:in `each'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/binder.rb:88:in `parse'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/runner.rb:151:in `load_and_bind'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/single.rb:96:in `run'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/launcher.rb:184:in `run'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/lib/puma/cli.rb:78:in `run'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/gems/puma-3.12.0/bin/puma:10:in `<top (required)>'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/bin/puma:23:in `load'
/home/deploy/my_app/shared/bundle/ruby/2.3.0/bin/puma:23:in `<top (required)>'
This is on a EC2 instance with Ubuntu 18.
Any help would be greatly appreciated.
This is the tutorial im following
http://www.dsolc.com/blogs/8-deploying-rails-app-to-ec2-instance-with-capistrano-using-nginx-and-puma
I installed Rails using RVM. Everything works fine like generating a new app with rails new app. bundle install and every other command runs fine as well.
But when I start my Rails server with rails -server I get the following error, which I'm not able to understand.
rails aborted!
NameError: undefined local variable or method `rver' for #<Rake::Application:0x00563aa7540988>
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:12:in `block in run_rake_task'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
/home/mrrobot/rails/demo/app/bin/rails:9:in `require'
/home/mrrobot/rails/demo/app/bin/rails:9:in `<top (required)>'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
/home/mrrobot/.rvm/gems/ruby-2.4.0#global/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
/home/mrrobot/rails/demo/app/bin/spring:15:in `require'
/home/mrrobot/rails/demo/app/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)
Ruby version: 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
Rails version: 5.0.2
RubyGems version: 2.6.11
It's rails server, without dash
or just
rails s
I am getting an error I have no clue how to fix it.
$ rails console
/Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:33:in `<module:Spring>'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:4:in `<top (required)>'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:77:in `preload'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:143:in `serve'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:131:in `block in run'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `loop'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `run'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
$ rails -v
Rails 4.2.5
$ rvm current
ruby-2.2.3
$ irb
2.3.0 :001 >
I am able to start the server with rails s and the app is working. I am able to deploy on Heroku and I can execute rails dbconsole.
Downgraded bundler from 1.11.x to 1.10.2
Removed the folder .bundler from ~ and any main folder of all rails projects (several)
Executed from the main folder of any rails project the command: bundle install --system
Problem solved.
I have an existing app that runs on Rails 2.3.14. I'm setting up my environment with RVM to use Ruby 1.8.7-p374, and I installed Rails 2.3.14, and it seems as if my install isn't working.
I'm trying to verify my install of Rails by running rails -v, however running that command yields this:
/Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup': undefined method `name' for #<Array:0x104f28960> (NoMethodError)
from /Users/jason/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `map'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `each'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `map'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:114:in `check'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:121
from /Users/jason/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:58:in `gem_original_require'
from /Users/jason/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:58:in `require'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/rubygems-bundler-1.4.2/lib/rubygems_executable_plugin.rb:4
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `call'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `run'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `each'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `run'
from /Users/jason/.rvm/gems/ruby-1.8.7-p374#leaselabs/bin/ruby_executable_hooks:10
I have resovled this.
method:rvm #global do gem uninstall bundler.
A few days ago I updated my gems because things weren't running so fine, so I went back to 1.4.2. Since then I'm getting all kind of weird errors.
I'm using Ruby 2.0.0p247, Rails 4.0 and Ubuntu.
If I try to start a new app using rails new eraseme, everything goes fine until it's time to do bundle install. The output is:
run bundle install
/usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `require': cannot load such file -- bundler (LoadError)
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:270:in `bundle_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/generators/app_base.rb:277:in `run_bundle'
from (eval):1:in `run_bundle'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `block in invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `each'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `map'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/invocation.rb:127:in `invoke_all'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/group.rb:233:in `dispatch'
from /usr/local/lib/ruby/gems/2.0.0/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/application.rb:43:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/cli.rb:15:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `require'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/bin/rails:9:in `<top (required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
If I try to open the console, I get:
>> bundle exec rails console
Loading development environment (Rails 4.0.0)
/usr/local/lib/ruby/2.0.0/irb/locale.rb:150:in `block in search_file': undefined method `try_activate' for Gem:Module (NoMethodError)
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:158:in `block in each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:167:in `each_sublocale'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:157:in `each_localized_path'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:145:in `search_file'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:124:in `find'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:108:in `load'
from /usr/local/lib/ruby/2.0.0/irb/locale.rb:32:in `initialize'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `new'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:114:in `init_config'
from /usr/local/lib/ruby/2.0.0/irb/init.rb:16:in `setup'
from /usr/local/lib/ruby/2.0.0/irb.rb:380:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
from /usr/local/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Have you already installed bundler? If not, try:
gem install bundler
If so, try:
gem install bundler --pre
If you running Ruby version manager, what version are you running? You might be set to the wrong version of Ruby.
I think it would be easier for you if you used RVM or some other version manager.
if you have multiple versions of rubygems installed, uninstall all but the one you want to use.
I think rails 4 requires rubygems 2.x.
Also check the bundler version.