Issue with SQLite gem when installing Ruby on Rails - ruby-on-rails

Error installing sqlite3, failed to build native gem extension.
Running on Windows 10.
Following a codeacademy tutorial, I successfully installed Ruby on Rails (ruby version : 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32) (rails version : 5.1.7). Running 'bundle install' popped up with an error saying I needed to download SQlite.
No problem, I go to the SQLite website and download sqlite3. Re-running 'bundle install', I get an error saying :
'An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'
succeeds before bundling.'
Following the suggestion, I run this command and get the following error:
'sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first. Could not create Makefile..'
I have download sqlite3 from the website, there is no sqlite3.h file in the folders. My google and SO searches have been fruitless.

Can you try the steps here:
https://medium.com/#declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b
Github thread - https://github.com/sparklemotion/sqlite3-ruby/issues/224#issuecomment-482612096

Go to Gemfile and replace gem'sqlite3' to gem 'sqlite3', '< 1.4'

Related

Rails server issue

It's my first time to use ruby on rails I installed rails from this link http://railsinstaller.org/en
I created my first project but I facing troubles when trying to run rails server, first, it requires to run
bundle install
After running bundle install
I see several issues in the command line
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.2 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.2/gem_make.out
An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
sqlite3
So how I can fix these pleas?
In your Gemfile try lowering the version of sqlite you're using.
gem 'sqlite3', '~>1.3.13'
Looking at https://rubygems.org/gems/sqlite3/versions/1.3.13-x86-mingw23 , 1.3.13 seems to be the latest supported version with mingw23.

An error occurred while installing pg (1.1.4), and Bundler cannot continue

Trying to execute bundle
$ gem install pg -v '1.1.14' --source 'https://rubygems.org/'
Gem files will remain installed in /home/saishbhende24/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pg-1.1.4 for inspection.
Results logged to /home/saishbhende24/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/pg-1.1.4/gem_make.out
An error occurred while installing pg (1.1.4), and Bundler cannot continue.
Make sure that gem install pg -v '1.1.4' --source 'https://rubygems.org/'succeeds before bundling.
In Gemfile:
pg
saishbhende24#DESKTOP-ELUO53H:/mnt/c/saishrails/r5.1$ gem install pg -v '1.1.14' --source 'https://rubygems.org/'
ERROR: Could not find a valid gem 'pg' (= 1.1.14) in any repository
ERROR: Possible alternatives: pg
Output is rails server
Make sure you have installed postgres for Windows. There are official installers here. Then try again.
Then, if you still experience problems, try manually installing the pg gem first by:
bundle install pg
If you still have trouble you can also look at running rails, postgres, and all your other dependencies like the rest of your gems, redis, etc., on docker. Running ruby on Windows is a notoriously horrible experience. There's many things which aren't as easy as they are on Linux. Docker can solve a lot of those problems for you if you're still having trouble.
gem sources --add https://rubygems.org/
Fixed this issue.

error occurred while installing pg (0.17.1)

When I run a bundle on a rails project I seem to be getting the following:
Installing pg 0.17.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r
./siteconf20151024-43303-t81fnp.rb extconf.rb checking for
pg_config... yes Using config values from /usr/local/bin/pg_config An
error occurred while installing pg (0.17.1), and Bundler cannot
continue. Make sure that gem install pg -v '0.17.1' succeeds before
bundling.
I have visited the following SO questions:
An error occurred while installing pg (0.17.1), and Bundler cannot continue
Installing pg -v 0.17.1
Installing PG gem on OS X - failure to build native extension.
Additionally to this I've tried executing the following:
gem install pg
env ARCHFLAGS="-arch x86_64" gem install pg
gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.4.5/bin/pg_config
And I keep getting:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
FYI I have rbenv installed too. Also tried a rbenv rehash also and executed the above commands and have had no luck. I've also tried uninstalling and reinstalling Postgres and get the same. To also be on the safe side i've also ran:
brew update
brew uinstall posgresql > brew install postgresql
updated Xcode
Info:
Mac OSx Yosemite 10.10.5
Postgres v9.4.5
rbenv v0.4.0
rbenv global => 2.0.0-p247
I don't know Mac, but I've had this problem on Windows.
--
The issue is here:
Failed to build gem native extension
When you install a gem, many of the advanced ones actually compile / "build" through the extconf.rb file. I've forgotten the significance of this, but it basically allows the gem to run natively on the OS environment you're using.
In short, the error occurs because your OS does not have access to the "developer headers" the gem requires to compile.
The most common instance of this problem is with the mysql2 gem on Windows, but happens for others too.
--
What you need is to download PGSQL on your system before attempting to install the gem.
After installing PGSQL, you may need to reference the developer headers with some "switches", but it does not appear to be the case in this instance:
Installing PG gem on OS X - failure to build native extension
Install Xcode command line tools (Apple Developer site)
brew uninstall postgresql
brew install postgresql
ARCHFLAGS="-arch x86_64" gem install pg
Maybe this won't work? I don't know... I know that in Windows, you have to install the binaries before expecting the gem to work.
Greetings I hope I can help. May I ask how you created your rails project? Did you simply use:
rails new *appname*
If so maybe try creating a new rails app like so:
rails new *appname* -d postgresql
And before you create your database and run migrations/seed, you should go into "config/database.yml" and change the username and password to the postgreSQL user that you've hopefully setup after installing postgreSQL on your machine.
Good Luck!

Error installing rb-fsevent (0.4.3.1)

I'm fairly new to rails. This may be a dumb question, but I can't seem to find a solution. Any suggestion is greatly appreciated.
I've just cloned a repository and I'm running "bundle install". I initially received a general error message regarding "rb-fsevent"when I ran "bundle install". I then just tried to install "rb-fsevent" individually, but received the following error message: (unfortunately I don't have enough reputation to post images...)
An error occurred while installing rb-fsevent (0.4.3.1), and Bundler cannot continue.
Make sure that gem install rb-fsevent -v '0.4.3.1' succeeds before bundling.
dhcp-50-74:sample_app SJ$ gem install rb-fsevent -v '0.4.3.1'
Building native extensions. This could take a while...
ERROR: Error installing rb-fsevent:
ERROR: Failed to build gem native extension.
/Users/SJ/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
creating Makefile
extconf.rb:21:in `': Only Darwin systems greater than 8 (Mac OS X 10.5+) are supported (RuntimeError)
extconf failed, exit code 1
The error message seems to suggest my Mac system is not 10.5+, however, I'm using a MacbookPro running Mavericks OS X 10.9.2.
First of all, read about fsevents here to know what it actually does.
The gem you're trying to install depends on native OSX libraries and you don't seem to be able to build 'em. Try installing command line tools for OSX and install the gem again.
Here's a good tutorial on how to install command line tools:
UPDATE
This was raised as an issue and the fix is to uninstall the previous version and install version 0.9.
gem install 'rb-fsevent' -v '0.9'
or update the gem dependency in your Gemfile:
gem 'rb-fsevent', '>= 0.9'

ERROR: While executing gem ... (Errno::EACCES) while installing nokogiri -v '1.5.6' Permission denied

I got a tough problem in ruby and rails.
I have already installed nokogiri-1.6.0, but the rails says that
You have requested:
nokogiri ~> 1.6.0
The bundle currently has nokogiri locked at 1.5.6.
Try running `bundle update nokogiri`
Then I tried "bundle install", it showed the follow:
Gem files will remain installed in /Users/johnhenry/valcuqw/vendor/bundle/gems/nokogiri-1.6.0 for inspection.
Results logged to /Users/johnhenry/valcuqw/vendor/bundle/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
In the GEMFILE, I changed to gem "nokogiri", "~> 1.5.6”, but it told me that
bundle install
Gemfile syntax error:
gem "zip-zip", "~> 0.1" # In Gem hell...
I am totally frustrated. Can someone give me a hand? Thanks!
I deleted the file: Gemfile.lock and had a continious loop of dots,so i restored it after quiting the process with ctrl + c ,so i went into the gemfile.lock file and manually picked the version of nokogiri i wanted,in my case 1.6.2.1, but i used nokogiri (~> 1.6.2),
hope this works for someone
Could possibly be because of the weird " symbol you have in the gemfile. See the last character in the nokogiri line?

Resources