Error when creating new Rails project - ruby-on-rails

I installed the Rails installer. Now I'm trying to create a new Rails project. When I do
C:\Sites> rails new demoproj
I get this error:
Fetching source index for http://rubygems.org/
Could not reach rubygems repository http://rubygems.org/
Could not find gem 'turn (>= 0)' in any of the gem sources listed in your Gemfile.

I'm assuming you are installing rails over proxy. This maybe what you are looking for:
Add the given option to your gemrc file
gem: -p http//#{proxy-server}:#{port}
Creating a new rails 3 project over a proxy in windows

in a general way, that problem means you need to do a bundle install. no clue if its a windows specific issue though, there should be an automatic bundle after it creates the project.

Related

Spring is troubling rails console to start

When i am trying to execute:
bundle exec rails console
It is throwing me error as:
/gems/spring-3.1.1/lib/spring/application.rb:96:in `preload': Spring only supports Rails >= 5.2.0 (RuntimeError)
Earlier it was working fine.
Can anyone help me with a workaround for this.
The workaround I did for this was to create a new project with rails 5.2.3 or something.
If you want to do the same, you can first list all your local gems by doing gem list rails --local
You will see all your rails versions installed locally.
Then do gem install rails -v '5.2.3'
Now go to a new project directory and run rails _5.2.3_ new appname
Now, you should be able to use the console, generate, migrate and other commands.
You can do bundle install after adding other relevant gems based on your apps requirement.

Use an older version of Rails with Rails 6 installed

Thank you this community for getting me started on the right path. Specifying rails version to use when creating a new application gets me close, but the differing ruby version is what is throwing me off. I'm running into an error after running rails new that I'm not sure where to begin to resolve it. I gather from the error that my command is missing a parameter, but I can't determine what it is.
Any advice?
I would like to create a rails 5.2.6 project and I'm finding consistent responses elsewhere indicating that my approach to getting a rails project created with a specific version is to:
install the rails gem with gem install rails -v 5.2.6
create a new rails project, specifying the rails version with rails _5.2.6 new appName
I think I'm on to it. Did a specific google search for compatibility of Ruby 3 with Rails 5 and appears this is the likely problem.
I've now run 'rvm install 2.7.4' then 'rvm use 2.7.4' but still seems to be using ruby 3 in the command. The new error:
user#ubuntudev:~/railsprojects$ rails _5.2.6_ new rpapitest
/home/user/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems.rb:281:in `find_spec_for_exe': can't find gem railties (= 5.2.6) with executable rails (Gem::GemNotFoundException)
from /home/user/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems.rb:300:in `activate_bin_path'
from /home/user/.rbenv/versions/3.0.0/bin/rails:23:in `<main>'
Try with rbenv global 2.7.4 if you have rbenv installed

SSL certificate Error While installing ruby on rails

I have installed Ruby on Rails using railsinstaller-3.2.0 [Ruby version:2.2.4 ,Rails version : 5.0.0.1].But while using the command rails new I am confronted with an error 1.
In addition, I am also facing another problem while using bundle install: it returns an exception The system cannot find the path specified.
screen shot of the error
Replace the ssl gem source with non-ssl:
gem sources -r https://rubygems.org/
gem sources -a http://rubygems.org/
execute above command in your command prompt.
After that
bundle install
and for creating new application please use this rails new your_new_application_name i,e rails new first_app

Creating a new rails 3 project over a proxy in windows

My computer works on a proxy. So in order to install gems I use the following command
gem install -p http//#{proxy-server}:#{port} rails
If i use the normal gem install command, I get an error could not find gem. I installed rails 3.1 today and tried to create a new project. Half the way while creating the files, the generator started executing run bundle install and ended up giving the same error
Fetching source index for http://rubygems.org/
Could not reach rubygems repository http://rubygems.org/
Could not find gem 'turn (>= 0, runtime)' in any of the gem sources listed in your Gemfile.
The generator is trying to install some gems without proxy. How can I override this existing functionality? I want the generator to use gem install -p http//#{proxy-server}:#{port} #{gem} instead of gem install #{gem}
Add the given option to your gemrc file
gem: -p http//#{proxy-server}:#{port}
Under unix this file is located under ~/.gemrc, for windows I don't know, but according to this answer should be
# Under windows XP
C:\Documents and Settings\All Users\Application Data\gemrc
# Under Windows Vista/Seven
C:\ProgramData\gemrc for windows Vista/Seven
The rc file needs to be created if not present.

Error while running rails on remote host. "Could not find crack-0.1.8 in any of the sources"

I am trying to deploy my rails app that is working fine on my local machine , to a remote host. I am using railsplayground.com to be exact. When I try to run the app using Passenger,I get this error
"Could not find crack-0.1.8 in any of the sources"
But when I did a,
$gem list
the gem , crack (0.1.8) is present. I am using Rails 3 btw.
Any suggestions is welcome. Thanks in advance.
Make sure the Gem is installed via Bundler. Check your Gemfile and see if the gem is listed.
Then, when deploying the application, make sure to execute the $ bundle install command.
If you deploy the project with capistrano, you can use the default bundler recipe by including the recipe at the top of your deploy.rb file.
require 'bundler/capistrano'

Resources