lundi 21 septembre 2015

how can I have the permission to write in gem directory in Ubuntu?

I'm trying to build my first app on Ruby on rails, but when I run bundle install I get this message

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 -r ./siteconf20150921-23095-eac5m6.rb extconf.rb  checking if the C compiler accepts ... yes Building nokogiri using

packaged libraries. checking for gzdopen() in -lz... no zlib is missing; necessary for building libxml2 * 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.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby2.1 --help --clean --use-system-libraries --enable-static --disable-static --with-zlib-dir --without-zlib-dir --with-zlib-include --without-zlib-include=${zlib-dir}/include --with-zlib-lib --without-zlib-lib=${zlib-dir}/lib --enable-cross-build --disable-cross-build

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20150921-23095-1bpxdrp/nokogiri-1.6.6.2/gems/nokogiri-1.6.6.2 for inspection. Results logged to /tmp/bundler20150921-23095-1bpxdrp/nokogiri-1.6.6.2/extensions/x86_64-linux/2.1.0/nokogiri-1.6.6.2/gem_make.out An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue. Make sure that gem install nokogiri -v '1.6.6.2' succeeds before bundling.

So I tried to install nokogiri using this command:

gem install nokogiri -v 1.6.6.2

but this message appears:

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /var/lib/gems/2.1.0 directory.

I also tried to run

sudo gem install nokogiri -v 1.6.6.2

but also this message apears:

Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension.

/usr/bin/ruby2.1 -r ./siteconf20150921-24140-1odizm6.rb extconf.rb checking if the C compiler accepts ... yes Building nokogiri using

packaged libraries. checking for gzdopen() in -lz... no zlib is missing; necessary for building libxml2 * 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.

Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby2.1 --help --clean --use-system-libraries --enable-static --disable-static --with-zlib-dir --without-zlib-dir --with-zlib-include --without-zlib-include=${zlib-dir}/include --with-zlib-lib --without-zlib-lib=${zlib-dir}/lib --enable-cross-build --disable-cross-build

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.1.0/gems/nokogiri-1.6.6.2 for inspection. Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.6.2/gem_make.out

I'm newbie with ubuntu and ruby on rails, how can I solve these problems?

Sorry for my bad language, English isn't my native.

Aucun commentaire:

Enregistrer un commentaire