gem install on bundle folder (vendor/bundle) - ruby-on-rails

I am trying to install a ruby project, which has a dependency like in Gemfile
nokogiri (1.6.1)
bundlr fails
An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
I followed the instructions to install nokogiri manually and succeeded (OSX 10.9.2)
which nokogiri
/usr/bin/nokogiri
nokogiri
Nokogiri: an HTML, XML, SAX, and Reader parser
Usage: nokogiri <uri|path> [options] ...
but, how can I install nokogiri to the expected path by the app (vendor/bundle , like the other dependencies, not in system folder). I tried an option --path vendor/bundle with gem install, but it is not recognized
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
I am running gem install as another user, that is why no permission to write to system folder. still, it is not trying to install at vendor/bundle.
It is also ok if I can find a way to use bundle (instead of gem) to install nokogiri. But, I am not sure how to specify the dependencies like the installation command below.
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

Try to create config for bundler in ~/.bundle/config:
BUNDLE_PATH: ./vendor/bundle
BUNDLE_BUILD__NOKOGIRI: --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
and after bundle install --path vendor/bundle.

On Mac I have tried the following and it worked.
bundle config build.nokogiri --use-system-libraries
bundle install --path vendor/bundle

Related

Rails install fail by permission denied

nokogiri install failure
What I want
Install ruby on rails
error
Gemfile is done, and I want to install rails.
Obaying the document, bundle install --path=vendor/bundle
but
An error occurred while installing nokogiri (1.10.3),
and Bundler cannot continue. The error is here.
Make sure that `gem install nokogiri -v '1.10.3'
--source 'https://rubygems.org/'` succeeds before bundling.
answer
I searched google for the error message, then find
[incompatible-library-version]
(Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib)
sudo gem uninstall nokogiri
gem uninstall nokogiri
sudo gem uninstall nokogiri
I obaied the command but it cause new error:
Permission denied # rb_sysopen - /usr/local/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.3/LICENSE-DEPENDENCIES.md
There 1614 lines dependencies document,
but I cannot find out what to do next.
Please help me (><)
Try
sudo chown -R $USER /usr/local/lib/ruby
And bundle install again or gem install again and netter not use sudo on gem install

ruby on rails gem file installation install bundle

I am new with ruby on rails. I have successfully installed ruby on rails 4.2 on Ubuntu 14.04 and created a new app, but when I started the server to see if it is working by writing:
rails server
I get this error message:
Could not find gem 'sass-rails (~> 5.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
And when I start to install bundle I get other packages that need to be installed before bundle.
Error message for bundle install
Gem::RemoteFetcher::FetchError: Errno::EHOSTUNREACH: No route to host - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/minitest-5.5.1.gem)
An error occurred while installing minitest (5.5.1), and Bundler cannot
continue.
Make sure that `gem install minitest -v '5.5.1'` succeeds before bundling.
then after I installed minitest and run bundle install
I got this error message
Gem::RemoteFetcher::FetchError: Errno::EHOSTUNREACH: No route to host - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://rubygems.org/gems/debug_inspector-0.0.2.gem)
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot
continue.
Make sure that `gem install debug_inspector -v '0.0.2'` succeeds before
bundling.
It keeps showing me packages that I need to install before bundle.
I'm not on Ubuntu, but I find with Rails 4+ this step-wise gem install is the rule rather than the exception. It doesn't seem to handle dependency gem installs very well with bundle. For each of the "missing" dependency gems, run the single gem install, and then the bundle again to see what's next It may reveal another dependency with each step, just install that. (The caveat is if you're seeing the same gems show up as not being installed on every bundle exec, then that's another problem altogether. Once you single-install the gem it should be locked in and available)
$gem install bundle
$gem install name-of-flagged-gem
$gem install bundle
$gem install next-missing-gem
Hope this helps.
Your solution should be right here: SSL Error
I had the same exact problem. Each time I did a "bundle install" it told me to make sure "gem install .... succeeds before bundling" And when I did what it said, it just told me about another gem.

Rails : bundle install nokogiri fail

When I run > bundle install
`An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
Ok, so I run > sudo gem install nokogiri -v '1.6.2.1'
I have this :
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.2.1/ext/nokogiri/gem_make.out
When I run the command : rails g controller...
Could not find gem 'rspec-rails (= 2.13.1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
Please help me!
Possible duplicates:
Mac OS X: Error to install Nokogiri on OSX 10.9 Maverick?
Ubuntu: Error installing Nokogiri 1.5.0 with rails 3.1.0 and ubuntu
The problem is probably that you have to natively install libxml and libxslt, which Nokogiri relies on.
If you run gem install nokogiri -v '1.6.2.1' | grep libxml, does anything show up?

issues deploying Rails site

I am attempting to deploy a site on a commercial hosting service. (JustHost.com)
I am having the following issue running bundle
# bundle
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-10.3.0.gem] in /home5/<username>/<sitename>
An error occurred while installing rake (10.3.0), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.0'` succeeds before bundling.
I am able to successfully run the gem install command:
# gem install rake -v '10.3.0'
Successfully installed rake-10.3.0
1 gem installed
Installing ri documentation for rake-10.3.0...
Installing RDoc documentation for rake-10.3.0...
But I get the same error re-running bundle. Furthermore, I don't think I was actually able to install rake - its location is not writable by me and the version is unchanged:
# which rake
/usr/bin/rake
# rake --version
rake, version 0.9.2.2
I also tried updating my Gemfile to use rake 0.9.2.2. but ran into the same issue:
# bundle
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-0.9.2.2.gem] in /home5/<username>/<sitename>
An error occurred while installing rake (0.9.2.2), and Bundler cannot continue.
Make sure that `gem install rake -v '0.9.2.2'` succeeds before bundling.
Any help appreciated!
What I did to get around this was update the .bashrc file per the instructions here. I also had to setup a javascript runtime so I used gems rubyracer with execjs.

Error occurred while bundle install coffee script

An error occurred while installing coffee-script-source (1.7.0), and Bundler cannot
continue.
Make sure that gem install coffee-script-source -v '1.7.0' succeeds before bundling.
After gem install coffee-script-source -v '1.7.0'
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
I think I just solve it.
The entire information the terminal returns when asking me to input password was:
Your user account isn't allowed to install to the system Rubygems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to Rubygems using sudo.
I is the password method that doesn't work but things got fixed after typing bundle install --path vendor/bundle.

Resources