Rails3 Console Command not working - ruby-on-rails

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.

Related

running Rails 5.1 console in production

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

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

rails installation dosn't work - can't check version

Hi I have installed passenger modul for apache2 and then i tried to install rails, with the command:
gem install rails
It seemed to be done well. But when I check the verison now with
rails --version
i got an error during this:
command not found....
You need to specify the PATH variable to folder where you have installed Rails, so when the 'rails' command will be triggered your system will know which program to launch.
Example: PATH=$PATH:/your_rails_folder

Rails command Error

Im about to start work on another web application, I change directories to
/rails_projects
and enter
rails new blank
I then get this error
Error: Command not recognized
Usage: rails COMMAND [ARGS]
The common rails commands available for engines are:
generate Generate new code (short-cut alias: "g")
destroy Undo code generated with "generate" (short-cut alias: "d")
All commands can be run with -h for more information.
If you want to run any commands that need to be run in context
of the application, like `rails server` or `rails console`,
you should do it from application's directory (typically test/dummy).
I have reinstalled rails, and still same error, any ideas?
UPDATE:
It actually give me the same error when I type just
rails -h
rails
in cmd
For anyone with a similar error that may land here, this fixed it for me:
rake rails:update:bin
This will generate "new" versions of the binaries. Just say Yes when it inquires you to replace them.
I ran into a similar issue when trying to upgrade a Rails Engine from 3.2 to 4.1.
The culprit was the presence of script/rails which contained:
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/my_project/engine', __FILE__)
require 'rails/all'
require 'rails/engine/commands'
The problem line is there at the end: require 'rails/engine/commands. That was not allowing the full Rails CLI to load which omitted the new command. Removing that file solved my problem.
I'm pretty sure this wasn't the cause of your specific problem, but the symptoms were the same as mine and this was the first link in Google for the error message. Just passing along my findings to help anyone else that runs into this same situation.
It looks like the rails command believes it's inside of a rails engine, which is why a different set of commands are available to you. Notice the 'commands available for engines' text. New is not a command available for engines. I'm not sure why rails thinks the directory you're in is an engine, but likely your directory structure is mixed up somehow.
If anyone runs into this error and needs a last resort plan.
I ended up uninstalling rails, rvm, and installing a newer version of ruby and new gemset.
rvm implode
gem uninstall rails -v=4.0.2
gem uninstall railities
install rvm :
curl -L https://get.rvm.io | bash -s
rvm get stable
for mac:
brew install libtool libxslt libksba openssl
brew install libyaml
install ruby:
rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/usr
if you have error
rvm install 2.0.0 --with-openssl-dir=$HOME/.rvm/opt/openssl
install new ruby gems from website. Unpackage it then go to folder and run
ruby setup.rb
gem update --system 2.1.9
install rails (you can choose your version)
gem install rails --version 4.0.2
gem install railties
I did this, and now system is working normal again.
Create another directory and run $ruby -v, check which version is available. Now run rails new app_name. Try once after closing the terminal and restarting.
This happen to me when a require error occurred in a gem (dependency) while loading.

Coda Terminal can't find rails

I've installed rails using rvm and everything works well in the out of the box terminal using zsh. I thought i'd simplify things a bit and bring out Coda's terminal but for some reason when I run
$ rails --version
I get errors saying there are missing dependencies or when using $ rails new new_app Coda terminal tells me that rails isn't installed. running $ gem list and $ gem environment give me the same output in both terminals.
you need to load rvm before using it
load rvm script with
source ~/.rvm/bin/rvm

Resources