i have a problem with ruby. I tried a lot but nothing works for me.
When i want to start the rails server, i get this error message:
An error occurred while installing pg (0.18.1), and Bundler cannot continue. Make sure that "gem install pg -v '0.18.1" succeeds before bundling.
This is what i tried already:
sudo install gem bundle install bundle install --path vendor/cache gem install pg -v '0.18.1'
When i try gem install pg -v '0.18.1'
i get this error message:
Could not find gem 'pg (>= 0) ruby' in any of the gem sources listed in your Gemfile or installed on this machine. Run
bundle install
to install missing gems.
But bundle install
doesn't work either. I get this error message:
An error occurred while installing pg (0.18.1), and Bundler cannot continue. Make sure that
gem install pg -v '0.18.1'
succeeds before bundling.
I also tried to start the server in a new ruby project.
Nothing helps..
Thanks for your help!
These are my changes in my Gemfile:
group :production do gem 'pg' gem 'rails_12factor' end group :development do gem 'sqlite3' end
Almost seems like running 'gem install' adds it to the global available gems (and hence terminal can run the package's commands), whereas adding it to the gemfile and running bundle install only adds it to the application. Similar to npm install --global. that's basically it.
gem install , in its simplest form, does something kind of like this. It grabs the gem and puts its files into a special directory on your system. You can see where gem install will install your gems if you run gem environment (look for the INSTALLATION DIRECTORY: line):
If you're on Ubuntu, most likely you're missing a hidden dependency
sudo apt-get install libpq-dev
If you are on OS X, try these steps
brew update
.brew uninstall postgresql
brew install postgresql
gem install pg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With