I managed to install it locally without any problem but on my VPN I can't follow the guide at all. Execution stops at gem install rails -v 3.2.3 with an error that I can't seem to fix after googling for hours.
gem install rails -v 3.2.3
========================================
Fetching: i18n-0.6.0.gem (100%)
Fetching: multi_json-1.3.6.gem (100%)
Fetching: activesupport-3.2.3.gem (100%)
Fetching: builder-3.0.0.gem (100%)
Fetching: activemodel-3.2.3.gem (100%)
Fetching: rack-1.4.1.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.1.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.3.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.33.gem (100%)
Fetching: activerecord-3.2.3.gem (100%)
Fetching: activeresource-3.2.3.gem (100%)
Fetching: mime-types-1.19.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.3.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: json-1.7.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/home/app-user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
generator.c: In function 'isArrayOrObject':
generator.c:867:5: warning: suggest parentheses around '&&' within '||'
linking shared-object json/ext/generator.so
make install
/usr/bin/install -c -m 0755 generator.so /home/app-user/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.4/lib/json/ext
installing default generator libraries
Gem files will remain installed in /home/app-user/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.4 for inspection.
Results logged to /home/app-user/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
The guide I'm using: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
I tried other guides as well. Same error pops out. Any ideas?
Related
When I download the rails application from github
https://github.com/ari/jobsworth
An then give bundle install it throws error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
An error occurred while installing mysql2 (0.4.4), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.4'` succeeds before bundling.
After I give the sudo gem install mysql2 -v '0.4.4' and it displays like:
Fetching: mysql2-0.4.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.4.0/gems/mysql2-0.4.4/ext/mysql2
/usr/bin/ruby2.4 -r ./siteconf20180212-10708-v1q8lj.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.4.0/gems/mysql2-0.4.4 for inspection.
Results logged to /var/lib/gems/2.4.0/extensions/x86_64-linux/2.4.0/mysql2-0.4.4/gem_make.out
After run bundle install it throws same error.
Running these commands worked for me.
brew install openssl
bundle config --global build.mysql2 --with-opt-dir="$(brew --prefix openssl)"
bundle
You can refer to this link for further help https://github.com/brianmario/mysql2/issues/1005
I have upgraded to Mavericks OS X and I started getting this warning.
➜ d3 git:(master) rspec
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.0
➜ d3 git:(master) ✗ nokogiri -v
Nokogiri (1.6.0)
---
warnings: []
nokogiri: 1.6.0
ruby:
version: 1.9.3
platform: x86_64-darwin13.0.0
description: ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin13.0.0]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: /Users/tyler/.rvm/gems/ruby-1.9.3-p448#d3/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0
libxslt_path: /Users/tyler/.rvm/gems/ruby-1.9.3-p448#d3/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin13.0.0/libxslt/1.1.26
compiled: 2.8.0
loaded: 2.8.0
This problem has already a lot of answers on StackOverflow. Basically you just have to uninstall/reinstall the gem and everything will be ok. If you want an older version of libxml2 then you'll have a hard time (as I currently do).
Just so you now, "nokogiri -v" won't give you the same loaded version as used when loading the gem from ruby or rails, I don't know why. This is the piece of code I use to know if I'm in the correct versions:
puts "nokogiri: #{Nokogiri::LIBXML_VERSION} / #{Nokogiri::LIBXML_PARSER_VERSION}"
It uses the same constants nokogiri uses internally to check if versions match.
I'm using rbenv and rbenv-gemset to manage the gems for a middleman project.
Even though I've run the rbenv rehash command, the shim for middleman does not exist:
→ middleman git:(master) × rbenv which middleman
rbenv: middleman: command not found
You can see here that I do have the middleman gem installed though:
→ middleman git:(master) × gem list middleman
*** LOCAL GEMS ***
middleman (3.1.5)
middleman-core (3.1.5)
middleman-more (3.1.5)
middleman-sprockets (3.1.4)
And here it is in my rbenv-gemset directory:
→ middleman git:(master) × ls .gems/gems
middleman-3.1.5
middleman-core-3.1.5
middleman-more-3.1.5
middleman-sprockets-3.1.4
And here you can also see there is a middleman command in the rbenv-gemsets directory:
→ middleman git:(master) × ls .gems/bin/
bundle erubis kramdown padrino rails rake2thor ri sass-convert sprockets tilt
compass haml middleman rackup rake rdoc sass scss thor tt
Yet running rbenv rehash does not generate the middleman shim (among others) :
→ middleman git:(master) × ls ~/.rbenv/shims
bundle dnsimple.rb gem rackup rdoc sass sdoc testrb tt update_rubygems
compass erb httparty rails ri sass-convert sdoc-merge thor unicorn
dnsimple erubis irb rake ruby scss sprockets tilt unicorn_rails
Here is my gem environment:
→ middleman git:(master) × gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.7
- RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-darwin12.4.0]
- INSTALLATION DIRECTORY: /Users/asgeo1/Projects/myproj/middleman/.gems
- RUBY EXECUTABLE: /Users/asgeo1/.rbenv/versions/1.9.3-p448/bin/ruby
- EXECUTABLE DIRECTORY: /Users/asgeo1/Projects/myproj/middleman/.gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /Users/asgeo1/Projects/myproj/middleman/.gems
- /Users/asgeo1/.rbenv/versions/1.9.3-p448/gemsets/global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
What could be going wrong? Is this an issue with rbenv or rbenv-gemset?
funnily enough, somebody reported the exact same problem just a few days ago - and with middleman too. The problem has now been fixed (see https://github.com/jf/rbenv-gemset/issues/48). The problem in this case was rbenv-gemset. Sorry about that!
You can upgrade to the latest version of rbenv-gemset to get the fix (are you using git? or homebrew?)
EDIT #asgeo1, you might want to "accept" that answer, so that others who come by will be helped as well. Thanks.
I'm trying to deploy to heroku and I'm having an issue:
when i run heroku rake db:seed (which creates the admin user in my db), rails returns that I have pending migrations.
I've deleted these migrations manually (which I shouldn't have, I know), how can I go around this ?
Charlie#CHARLIE-PC /c/rails/rails_projects/METACRITIC (master)
$ rake db:migrate
Charlie#CHARLIE-PC /c/rails/rails_projects/METACRITIC (master)
$ heroku run rake db:seed
Running `rake db:seed` attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support
for these plugins will be removed in Rails 4.0. Move them out and bundle them i
n your Gemfile, or fold them in to your app as lib/myplugin/* and config/initial
izers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonr
ails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required
)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support
for these plugins will be removed in Rails 4.0. Move them out and bundle them i
n your Gemfile, or fold them in to your app as lib/myplugin/* and config/initial
izers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonr
ails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required
)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support
for these plugins will be removed in Rails 4.0. Move them out and bundle them i
n your Gemfile, or fold them in to your app as lib/myplugin/* and config/initial
izers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonr
ails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required
)> at /app/Rakefile:7)
You have 2 pending migrations:
20121013054027 Addcolumnimagetoshow
20121013063205 AddAttachmentToShows
Run `rake db:migrate` to update your database then try again.
Charlie#CHARLIE-PC /c/rails/rails_projects/METACRITIC (master)
$
You were running your migrations locally (rake db:migrate) instead you should run the on heroku heroku run rake db:migrate
I'm trying to install rails 3.0.7 on Mac OSX. I'm using rvm and I've got ruby 1.9.2p180 installed.
When I run
gem install rails --version 3.0.7
It seems to work fine, until it gets to the mail gem.
Fetching: mail-2.2.17.gem (100%)
ERROR: While executing gem ... (Zlib::DataError)
invalid block type
The installer them stops and rails is not installed. How do I get around this?
Update: Since I asked this question the mail gem has been updated to 2.2.19, and this seems to have solved the problem.
I just replicated your env (MacOS, ruby 1.9.2) and rails installed fine, along with the mail gem (2.2.17).
Perhaps try again? Maybe the package that was fetched was temporarily corrupt. You can also run gem with the verbose flag to see more info:
gem install rails -V --version 3.0.7