Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'rails c' doesn't work, but 'bundle exec rails console' does

I'm setting up the staging and production server on Ubuntu, deploy with Capistrano. Both server has pretty much the same setup. But for for some reason. I can access console on production server with rails c produciton. But when I try to access console on staging server using rails c staging

The program 'rails' can be found in the following packages:
 * ruby-railties-3.2
 * ruby-railties-4.0
Try: sudo apt-get install <selected package>

The only way to access console on my staging server is to do

bundle exec rails console staging

On staging

  • the rvm seems to be correct, I can see the ruby version I'm using.
  • the gemset that the application use is there.
  • the application is running fine. Just can't access console with 'rails c'

But for some reason, I can't access console with rails c. Any idea how to solve this issue?

like image 248
Tar_Tw45 Avatar asked Nov 30 '25 06:11

Tar_Tw45


1 Answers

I guess you didn't install rails globally. First, check your rails version you are currently using by bundle exec rails -v. Then, install rails globally by gem install rails -v <version>. This should solve your issue.

Run bundle install only makes rails available inside bundler. In most cases, this should be enough, because bundler helps prevent headaches of version conflicts.

like image 189
Van Huy Avatar answered Dec 02 '25 21:12

Van Huy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!