I just started to learn Ruby on Rails by following some tutorials. Rails had been working well until one day it just stopped working. The code following is what I got from the Terminal when I tried to run rails:
$ rails -v
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
WARN: Unresolved specs during Gem::Specification.reset:
i18n (>= 0.6.9, ~> 0.6)
json (>= 1.7.7, ~> 1.7)
tzinfo (~> 1.1)
minitest (~> 5.1)
thread_safe (~> 0.1)
rake (>= 0.8.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Could not find sqlite3-1.3.9 in any of the sources
Run `bundle install` to install missing gems.
So I ran bundle install and gem install sqlite3-1.3.9 but neither of them worked. The code following is from the Terminal when I ran gem install sqlite3-1.3.9:
$ sudo gem install sqlite3 -v '1.3.9'
Password:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
But when I tried 'port install sqlite3 +universal', 'yum install sqlite-devel' and 'apt-get install libsqlite3-dev', the terminal showed:
$ apt-get install libsqlite3-dev
-bash: apt-get: command not found
Command is not found even for yum and port. Some people said that I should install ruby-dev package and possibly the libsqlite3-dev (Ubuntu) or sqlite-devel (Fedora) package as well, but I don't know how to do it. What should I do? Should I reinstall Ruby and Rails? Thank you very much!!!
Related
Using rbenv for a Ruby 2.3.0 environment on OS X 10.11.1 I am unable to get therubyracer Gem to install when using 'bundle'.
This is successful:
> gem install therubyracer
Building native extensions. This could take a while...
Successfully installed therubyracer-0.12.2
Parsing documentation for therubyracer-0.12.2
Done installing documentation for therubyracer after 0 seconds
1 gem installed
In my Gemfile:
gem 'therubyracer', '0.12.2', platforms: :ruby
This fails:
> bundle
Installing therubyracer 0.12.2 (was 0.12.1) with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/jsidlosky/code/sentons/websocket-rails-demo/.bundle/gems/therubyracer-0.12.2/ext/v8
/Users/jsidlosky/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160215-9105-1s1s0pv.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details.
You may need configuration options.
....
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/jsidlosky/code/sentons/websocket-rails-demo/.bundle/extensions/x86_64-darwin-15/2.3.0-static/therubyracer-0.12.2/mkmf.log
The mkmf.log file's error is:
conftest.c:3:10: fatal error: 'v8.h' file not found
Some things I've tried:
From: How to install therubyracer gem on 10.10 Yosemite?
git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake clean build binary
gem install pkg/libv8-3.16.14.13.gem
From: Bundle install tries to use cache file
Adding to ~/.bundle/config
BUNDLE_PATH: .bundle
BUNDLE_DISABLE_SHARED_GEMS: "1"
I also tried this:
bundle config build.libv8 --with-system-v8
I've now spent well over 5 hours trying other random ideas from various StackOverflow questions and other sites. So far, nothing gets me a working therubyracer inside "bundle" even though "gem install therubyracer" works just perfectly.
I will be very grateful for any pointers or solutions.
It appears from the comment from: github.com/cowboyd/therubyracer/issues/359
"I wasn't able to get any of the above solutions to work (or rather, everything I could get to work would have required the rest of my team to rebundle). After switching from rbenv to RVM, however, bundle install ran without a hitch."
I tried switching from rbenv to RVM and it worked perfectly. I can now 'bundle' and therubyracer gem installs perfectly.
I've seen multiple questions, all with the same problems as me. I tried all the solutions proposed, such as making the following my Gemfile
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Added, committed, and nothing. Still the same issue when I run git push heroku master:
em::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
tmp/build_d2c698fb-cf76-40cd-b046-9866c3432e8b/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
I tried installing Xcode to see if that solves it, but it didn't. Ran brew install sqlite3 which also didn't solve it.
I also checked the dependencies of my gems in my Gemfile, with gem dependency and also checking the Gemfile.lock file, which shows no dependencies for the sqlite3 gem.
I can't find a solution to this problem from existing questions. Maybe I skimmed over something I am missing, but I can't find it.
Some extra information:
$ rails -v
Rails 4.1.1
$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin13.1.0]
$ gem -v
2.2.2
$ sqlite3 -version
3.7.13 2012-07-17
Any idea how to fix this?
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/durrantm/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for vm_core.h... no
checking for vm_core.h... no
Makefile creation failed
**************************************************************************
No source for ruby-1.9.3-p194 provided with debugger-ruby_core_source gem.
**************************************************************************
I had this issue after updating to a newer patch version of ruby. Unfortunately the header files gem "debugger-ruby_core_source" was locked in to an earlier version in the Gemfile.lock so it didn't have the required header files.
All you need to do is update that gem by doing:
bundle update debugger-ruby_core_source
You should be able to bundle install afterwards.
If you aren't using bundler then just install the latest version before trying to install debugger:
gem install debugger-ruby_core_source
Another option is to switch to using ruby p125, e.g.
rvm install 1.9.3-p125
rvm use 1.9.3-p125 --default
I had ruby 1.9.3-p194 and apparently that doesn't have the debug/linecache I need.
open terminal, go to project directory and remove Gemfile.lock using
rm Gemfile.lock
to remove Gemfile.lock and run
bundle install
which will create new Gemfile.lock so its easy to do it :)
worked for me.
While trying to run a first project on Ubuntu 10.10 I got this:
antonio#antonio-desktop:~/Documents/tickets$./script/rails server
Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
Well, afterwards I write:
antonio#antonio-desktop:~/Documents/tickets$ bundle install
and get this in the middle of the installation process:
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
So, I tried this:
sudo yum install sqlite3-devel
And got this:
Setting up Install Process
No package sqlite3-devel available.
Nothing to do
Why? I'm running Rails 3.1, btw.
try: sudo apt-get install libsqlite3-dev
Since you're using yum, I went ahead and guessed that you're on Fedora. I then Googled "fedora sqlite3" and found a blog post that recommends this:
sudo yum install sqlite-devel
Sounds like the gem doesn't have the package name quite right. Give this one a go :)
Following this guide, I'm attempting to set up Ruby on Rails using Amazon's EC2. For my instance I've selected "Basic 32-bit Amazon Linux AMI 2010.11.1 Beta". I have ruby, sqlite, and rubygems installed. I'm on step 3.3 of the linked guide which is to run the following command
bundle install
The result is the following. I'm sure I've just missed something, but I'm at a loss. Any suggestions?
Installing sqlite3 (1.3.3) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems /installer.rb:529:in `build_extensions': ERROR: Failed to build gem native extension (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-1.3.3 for inspection.
EDIT: Following the suggestion below to install ruby-devel, I now get this error in addition to the original one.
Installing sqlite3 (1.3.3) with native extensions /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions':
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
But when I try to run
yum install sqlite-devel
I'm told:
Package sqlite-devel-3.6.20-1.6.amzn1.i386 already installed and latest version
Nothing to do
In addition to the packages above, mas sure you have gcc and make installed.
They are needed to build the gems you are installing in addition to the development libraries.
Try to install the libsqlite3-dev before
$ sudo apt-get install libsqlite3-dev
and retry to install the gem after
$ gem install sqlite3-ruby
This worked for me:
yum install ruby-devel
yum install sqlite-devel
NOT sqlite3-devel
Venturing a guess here, but you might be missing a few development packages. Try running:
yum install ruby-devel sqlite3-devel