I'm having issues with the libv8 gem with ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]. gem install libv8 works fine and I have
gem 'therubyracer'
in my Gemfile and this has a dependency on libv8 which is installed when I do a bundle install:
$ bundle exec gem list
*** LOCAL GEMS ***
actionmailer (3.1.3)
actionpack (3.1.3)
...
libv8 (3.3.10.4 x86_64-darwin-10)
...
but when I run:
$ rails s
Could not find libv8-3.3.10.4 in any of the sources
Run `bundle install` to install missing gems.
it can't find libv8 - is this is a 32/64 bit issue? If so, how do I solve it?
I suspect this was because I had a 32/64 bit mismatch.
I solved this with the following:
$ irb
ruby-1.9.3-p0 :001 > `gem list`.each_line {|line| `sudo env ARCHFLAGS="-arch x86_64" gem install #{line.split.first}`
I had a similar problem deploying from an x86 dev box to an x86_64 server (using capistrano)
When I did the deployment, I got the same 'Could not find libv8-3.3.10.4 in any of the sources' message. This is because running 'bundle pack' on an x86 machine only copies the x86 gem into the /vendor/cache directory!
I fixed this by explicitly adding the linux x86_64 gem file to the /vendor/cache directory, so that it would agree with the deployment server architecture. Deployment ran fine after that.
Another solution is to use nodejs instead of therubyracer. You install it on the server using apt-get/yum, so there's no need for your Gemfile to include execjs or therubyracer.
You can actually install that version on Mavericks:
gem install libv8 -v 3.11.8.17 -- --with-system-v8
You can provide whatever libv8 gem version you want to install ..
After this you might facing issue with installing therubyracer then
Update Version of Gemfile to point to the last version like so:
gem "therubyracer", "~> 0.10.2"
and I was able to successfully install the gem.
If you want to manually install the gem, you can use:
gem install therubyracer --version "~> 0.10.2"
Have you tried bundle exec rails s? It's possible that there's a conflict between the gems you have installed on your system and the gems that are required for your project to run.
I resolved this issue by installing nodejs (latest version). What it does is that it installs the libv8 -dev library along with it. Thus rather than installing the gem what you require is the native library.
You can install it directly or install nodejs as well in your system and the above error should be resolved.
Related
I have rails project working on Ubuntu.
Now I installed WSL on another machine and cloned the very same project.
Now when I try to install bundler with
gem install bundler
it installed bundler 2.0.2 and on bundle install it gives error:
Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails (~> 5.0.0)'
Now I looked at the gemfile.lock it was bundled with 1.16.4, I installed it with
gem install bundler -v '1.16.4'
Now I do a simple bundle install, then it uses 2.0.2, so I have to do
bundle _1.16.4_ install
It completed successfully, but now when I am trying to do rails db:create, it says
The git source https://github.com/activerecord-hackery/ransack.git is not yet checked out. Please run bundle install before trying to start your application
What's wrong here?
Uninstall bundler 2.0.2:
gem uninstall bundler -v 2.0.2
If you still have problem, you can use:
bundle exec rails db:create
You can update to using bundler 2.x if possible with:
bundle update --bundler
This will change the BUNDLED_WITH version in Gemfile.lock.
see: https://bundler.io/guides/bundler_2_upgrade.html
You could also set the default bundler version:
bundler config default 1.16.4
gem list bundler
However I have found this to be a bit error prone.
Try to remove all your gems (go to the gems folder of your ruby, remove the specifications folder and the gems folder),
gem list should be more or less empty
gem install bundler
And try to bundle install again from scratch.
I am trying to run "bundle update", but I keep getting the error message:
An error occurred while installing rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.
Then I install rack 2.0.1:
sudo gem install rack -v 2.0.1
Successfully installed rack-2.0.1
Parsing documentation for rack-2.0.1
Done installing documentation for rack after 2 seconds
1 gem installed
Then I even ran "rbenv rehash", and I run "bundle update" again and the same error message shows up. How do I get Bundler to recognize the new gem?
Make sure you have the "bundler" installed from the ruby version installed by rbenv first. Then, check the ruby version in that directory. It should be the one that you installed from rbenv or rvm. After these, if you are installing something just don't use sudo before bundle. Because bundle is from the rbenv ruby version. If the rbenv rehash doesn't work, just restart the bash and check.
If the without sudo thing needs permission, you are most likely using the bundler that was installed by your system ruby as sudo gem install bundler.
Try reinstalling bundler without a sudo like gem install bundler and retry.
Even if that doesn't work, remove the Gemfile.lock in your directory. Remove any version of rack mentioned in your Gemfile if any. Just have the gem name like gem 'rack' and try bundle install again. The gem that you could install with sudo was stored for the system ruby, not the one you have installed through rbenv.
When you ran sudo install, your gem most probably got installed under a different directory. When using Rbenv or VRM, you shouldn't use sudo.
First of all you could try uninstalling the gem from your system gems and doing it again without sudo.
Going into extremes you could completely reinstall your rbenv with gems (and while at it switch to RVM, personally I think its easier to manage). After that try to bundle install everything again without sudo and it should work.
The Rails project I'm working on includes the gem 'therubyracer' on its Gemfile. When I do
bundle install I get the following error:
...
Using launchy 2.4.2
Using less 2.4.0
Using less-rails 2.4.2
Bundler::GemspecError: Could not read gem at /Users/Swanros/.rvm/gems/ruby-2.0.0-p353#c-bullz/cache/libv8-3.16.14.3-x86_64-darwin-12.gem. It may be corrupted.
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
When I do gem install libv8 -v '3.16.14.3 it succeeds, and I cant finish bundling my project.
I've already uninstalled libv8, reinstalled it again, as well as therubyracer, and I still can't manage to get this to work.
Any ideas?
This solved my problem:
rm -rf /Users/Swanros/.rvm/gems/ruby-2.0.0-p353#c-bullz/cache/
:D
I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks.
Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me.
assuming you use rbenv:
rbenv install 1.8.7-p375
rbenv rehash
rbenv global 1.8.7-p375
bundle install
I upgraded ruby to 1.9.3, and now I can't get my server to start. When I run bundle install, it says
An error occurred while installing libv8 (3.11.8.17), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.17'` succeeds before bundling.
When I try to install that gem, it says
ERROR: Error installing libv8:
ERROR: Failed to build gem native extension.
/Users/Erica/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
I'm an HTML/CSS coder, not really a Ruby developer, so any thoughts are really appreciated.
I resolved this issue by using the following command:
gem install libv8 -v 3.11.8.17 -- --with-system-v8
It works with RVM on Mavericks.
https://stackoverflow.com/a/19667419/763744
Try reinstalling v8 in homebrew:
gem uninstall libv8
brew install v8
gem install libv8
Do:
gem install rmagick -v '2.13.2'
gem install libv8 -v 3.11.8.17 -- --with-system-v8
I encountered this problem a few times already, first thing I'd try is to (re)install command line tools. Normally should work.
Another attempt that succeeded once was uninstalling libv8, and then installing it again. It takes ages...
This simple solution worked for me:
$ gem uninstall libv8 # select "All Versions" if prompted
$ gem install libv8
I had this same problem when I upgraded from OSX Mountain Lion to OSX Mavericks.
Upgrading from ruby-1.8.7-p354 to ruby-1.8.7-375 did the trick for me.
libv8 (3.16.14.3-x86_64-darwin-13) and the therubyracer (0.12.0) gems installed without problem.
assuming you use rbenv:
rbenv versions
system
* 1.8.7-p354
2.0.0-rc2
rbenv uninstall 1.8.7-p354
rbenv install 1.8.7-p375
rbenv versions
system
* 1.8.7-p375
2.0.0-rc2
bundle install
Complete new person to Ruby and Rails here... Have tried some tutorials in the past, but that's about it. I'm trying to follow 'Ruby on Rails 3 Tutorial' book and have hit a roadblock that I haven't been able to find any help for after searching on here and the Google..
I haven't actually done anything yet; only:
rails new first_app
then changed the Gemfile sqlite3 to
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
When I run 'bundle install' I get the following:
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
I've tried uninstalling the bundler via
gem uninstall bundler -v 1.1.3
and then installing bundler v1.0.0 via
gem install bundler -v 1.0.0
but it seems to get me bundler 1.1.2..
I just feel like I've hit a dead end and can't find any more information on how to solve this issue.
Any help would be greatly appreciated and rewarded with copious amounts of bacon...
UPDATE UPDATE UPDATE
I couldn't get bundler v 1.1.2 to uninstall. I finally was able to uninstall all of the gems by doing:
sudo gem list | cut -d" " -f1 > gem_list.txt
cat gem_list.txt | xargs sudo gem uninstall -aIx
cat gem_list.txt | xargs sudo gem install
And then reinstalling... This allowed me to then do the 'bundle install' and get on track.. Thank you all for your help!
it is because gems are also installed in global gemset, and you can uninstall it using:
rvm #global do gem uninstall bundler
but you can also use the other version of bundler using:
gem install bundler -v '~>1.0.0'
bundle _1.0.0_ install
replace 1.0.0 with the version that got installed (if other)
First verify your versions to be sure they're all current:
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
$ rails -v
Rails 3.2.2
$ gem list bundler
*** LOCAL GEMS ***
bundler (1.1.3)
If you need to update ruby, you can download it from https://www.ruby-lang.org or use tools like ruby-build. If you have any version of Ruby 1.9.3 that's fine for now.
To update all your gems:
gem update --system
gem update
Gem may install gems in a few different places, and these can interfere with each other. There are system gems (typically installed by root or by using sudo) and your personal user gems. My favorite way to manage these is with a simple tool called rbenv. A related tool is rvm. Either is fine.
For your first tutorial, you can skip using version numbers in your Gemfile:
- gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
+ gem 'sqlite3-ruby', :require => 'sqlite3'
Bundler will sort everything out the right way. Eventually you'll want to specify version numbers if you're coordinating with other developers, or building production systems.
Feel free to ask questions here and I'll add to this answer.
Maybe you had bundler 1.1.2 AND 1.1.3 installed on your machine (and possibly more versions)
use
gem list bundler
to check which version(s) of bundler you have installed.
Then remove the ones you don't want with
gem uninstall bundler -v VERSION_NUMBER
You can use latest version of Rails 3.0 (3.0.12). It supports the latest bundler, and isn't fundamentally different from 3.0.1
I had this problem and the source was a version specification for bundler in the .gemspec file:
spec.add_development_dependency "bundler", "~> 1.16"
Removing the version number solved the issue:
spec.add_development_dependency "bundler"
Bundler is a dependent gem of rails, because of which you can see it only in gemfile.lock instead of gemfile.
For a particular rails version only a range of bundler gems are compatible. I also got this error and I tried uninstalling that version of bundler gem which I didn't need. I also tried to install forcefully using bundle_x.x.x_install, but when things didn't work I explicitly mentioned the gem specifying the version falling within the range required by rails version I am using. May be it's not the right way but that is how things worked for me.
Sometimes to fix the issue mentioned in the title of this question it is enough to delete Gemfile.lock and run bundle update. I hope it will be helpful for someone.