I am new to rails and I am having a problem with starting a web server. After I type in "rails server" in my terminal, I see the following error.
How can I fix this? I tried gem pristine stuff as suggested but it didn't work.
Try gem install bundler and install dependencies.
If bundler is not install, install bundler with command: gem install bundler
Install all gem with command: bundle install or bundle.
Then Configure your database to the database.yml.
Create new database: rake db:create
Then start rails server.
rails server or rails s
Related
I've replaced the gem mysql2 for a sqlite3 in development environment. However Rails keeps looking for it. I've tried to delete Gemfile.lock and it didn't work. I've also changed the database.yml file.
This is the error when I do rails db:create
LoadError: cannot load such file -- /home/gn09/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/arel-9.0.0/lib/arel/visitors/mysql.rb
replace gem in Gemfile
#gemfile.rb
gem 'sqlite3'
database.yml
something like this
bundle
bundle update - update Gemfile.lock correctly
rails db:create db:migrate
rails s
First uninstall ruby
rbenv uninstall 2.6.1
Then install again to get a fresh set of gems
rbenv uninstall 2.6.1
Then install bundler
gem install bunder -v '2.1.4'
Then
bundle install
I've been running into issues with pg in my Rails gem. When I try to..
$ bundle install
..my terminal returns..
An error occurred while installing pg (0.21.0), and Bundler cannot
continue.
Make sure that `gem install pg -v '0.21.0'` succeeds before bundling.
My gemfile includes this:
group :production, :default do
gem 'pg'
end
The exercise I am doing is to deploy my Rails app in Heroku, and it works. The idea is that I do not install postgres locally.
This is my Github repo, if it helps: https://github.com/cyqurayte/Rails1
The idea is that I do not install postgres locally.
I don't think it's possible to install this gem without having postgres already installed and updated
The reason this works on heroku is that the environment there already has postgres installed
When I run $ rails -server to start a server, there comes an error:
Could not find gem 'sqlite3' in any of the gem sources listed in your Gemfile or available on this machine.
Does that mean I did not install sqlite3? How can I resolve the issue?
First, you have to install all Gems from your Gemfile.
This can be done with bundle install or in short bundle.
If this command executed successfully, you can run your server with rails s.
But I think it's better for you, to start with a tutorial.
server and s are not a switch, but a sub-command.
Run
$ rails server
or
$ rails s
I run into this issue previously, that is because you run bundle install, miss some gems, so you can $ bundle install again,
and you can test the sqlite if is installed:
$ sqlite3 --version
If successed, you can test the rails server.
I am trying to get a rails app up in production. I have uploaded it to the server, and ssh'ed into it without a problem. When I try to run: rake db:migrate RAILS_ENV=production, I get the following error:
Could not find rake-10.0.4 in any of the sources
Run `bundle install` to install missing gems.
So, I run bundle install and get the following error:
Gem::Exception: Cannot load gem at [/usr/local/lib/ruby/gems/1.9.1/cache/rake-10.0.4.gem] in /home/root/myapp
An error occurred while installing rake (10.0.4), and Bundler cannot continue.
Make sure that `gem install rake -v '10.0.4'` succeeds before bundling.
From here, I ran gem install rake -v '10.0.4' --no-rdoc --no-ri, and it succeeded:
Yet still, bundle install fails with the same error. What can I do to fix this?
Thanks for all the help guys!
I ended up redeploying after running bundle package, and then ran bundle install --deployment on the server, and now it works.
It looks like I/bundle needed to be more explicit about where to look for the gem files :)
Bundler will try to run Rake that is in your gemfile. You need to run bundle exec rake db:migrate RAILS_ENV=production
Obviously your installation is faulty. I suggest you re-do it from scratch, and if you'd like you better use rbenv
Please check this answer Install Ruby on Rails on Ubuntu 12.04 LTS
my suggestion will you please try. if you are not root user and running this rake commmad may be it will give error. why not you try to login as root user and then place and navigate to your code. home/root/myapp to var/yourfolder/yourapp then. check which version or ruby you are using ruby -v it should be 1.9 or above and the same for rails which version of rails you are using.
Um quite new to rails and um getting an error when run the command
rails s
it says
Could not find rake-0.9.2.2 in any of the sources
Run bundle install to install missing gems.
when I run bundle install nothing happened
my gem list has rake 0.9.2.2
what can go wrong?
my ruby version is 1.9.3
Thank you in advance
Remove all the versions of Rake ==> gem uninstall rake
Remove your gemfile.lock => rm Gemfile.lock
Remove gem 'rake' on your gemfile
Run bundle install
Install Rake manually : gem install rake --version=10.0.4
When you use command gem list, you will get a list of gem installed on your machine.
For example : rake (10.0.4, 10.0.3, 0.9.2.2)
Just see the console which gem is compatible with your application. It is already mentioned in the error log message.
Use
gem uninstall rake
Keep the suitable one and remove the version who is creating trouble. And then run rails s or bundle exec rails s
Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.3.]