running Rails 5.1 console in production - ruby-on-rails

I installed a Rails 5.1 app on a Ubuntu 14.04 server.
I have to run a rails console
so I changed directory to cd /opt/www/myapp/current
and entered the command:
rails c production
but then I get this error message:
The program 'rails' can be found in the following packages:
* ruby-railties-3.2
* ruby-railties-4.0
Try: sudo apt-get install
I tried to run the command with bundle:
bundle exec rails c production
but then I get this error message:
Undefined local variable or method `git_source' for Gemfile
from /opt/www/myapp/releases/20171017091250/Gemfile:3
I'm not sure what's going on.
Can someone help me run rails console on my production server?
Thanks a lot,
Anthony

Undefined local variable or method `git_source' for Gemfile
Or to save you visiting the link, try:
gem update bundler
git_source was added in bundler 1.6

found the issue, I needed to run the command
bundle exec rails c production
as the 'deploy' user

Related

How to fix bundler missing /usr/bin/ruby-mri (LoadError)?

I am executing the following line to test the installation of redmine-3.3:
bundle exec ruby script/server webrick -e production
> /usr/bin/ruby-mri: No such file or directory -- script/server (LoadError)
Apparently, the executable ruby-mri is missing. Does anyone know how I can fix this? I am running Fedora24. Installed ruby with dnf install rubygem-rails.
I installed ruby with dnf install ruby, now the file is present, but the error message stays the same. So there is a file /usr/bin/ruby-mri, but the error message complaints the file is not present. ???
It is the wrong command. script/server is outdated. Use instead:
bundle exec rails server webrick -e production

'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?
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.
A couple of questions to understand better the situation...
Have you tried running bundle install for the current ruby version set on rvm for that application on that server?
Have you updated the gems for another application/branch? sometimes that happens because the rails c command uses the latest gems available and bundle exec... locates and uses the gems tied to the Gemfile.lock.
The application should run fine because it uses the gems that the Gemfile.lock has listed.

How test a Rails app in a browser

I used Fedora 21 in VirtualBox to create a rails app.
I have installed Ruby, Rails, rubygem, and bundle ($ bundle install) for my rails app.
However, when I go to http://localhost:3000/, there is an error...
When I run this command :
$ rails server
There is an error : Could not find a Javascript runtime
Thank you for your help.
run bundle exec rails server if it still there try this
yum -y install nodejs
or look at this

Can't run command rails console on EC2 after deploy

I use AWS with Elasticbeanstalk to deploy my applications, but I can't run the command rails console once ssh to my server and going to /var/app/current.
I tried many commands, without success :
bundle exec rails c
RAILS_ENV=development rails c
I got the follow error:
Could not find addressable-2.3.6 in any of the sources
Run `bundle install` to install missing gems.
But when running bundle install everything is fine.
This error is a huge issue to me as I can't use the whenever cron job.
Can you help me ?
PS : Gist of my Gemfile here
ran into similar problem and this is what solved my problem:
you may try sudo gem install bundler from your root and later move to app/current and try run rails c -e environment_name

Rails3 Console Command not working

I was able to run rails console in a rails directory fine, however I ran into a problem running rails console --sandbox where I was getting an error like this:
no such file to load -- readline (LoadError)
After running this command: sudo apt-get install libncurses5-dev libreadline5-dev
(found here http://pranshuarya.com/jaal/Development/rails-3-error-require-no-such-file-to-load-readline-loaderror.html)
I now receive the following error when running either rails console or rails console --sandbox:
Could not find mail-2.2.16 in any of the sources
I am running Ubuntu 10.10, Ruby 1.9.2 and Rails 3
Any ideas?
I think that you could be having some gem in your gemfile but you did not run bundle install to install it. Please check that out.

Resources