Reputation: 58662
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
Upvotes: 11
Views: 13611
Reputation: 44360
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
.
Upvotes: 5
Reputation: 361
On Mac I have tried the following and it worked.
bundle config build.nokogiri --use-system-libraries
bundle install --path vendor/bundle
Upvotes: 0