简体   繁体   中英

Ubuntu 16.04: Error return on gem install bundler

I've been getting a return,

~$ gem install bundler
ERROR:  Loading command: install (LoadError)
cannot load such file -- zlib
ERROR:  While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass

When trying to install Jekyll via gem bundler

I've found lots of resources of others getting this error such as,

I've recompiled ruby after sudo apt-get libssl-dev as well as a few other dep/libs I could think of,

but no results. Any other ideas someone has?

Setup: Dell 2120 Ubuntu 16.04 LTS

The package zlib is missing and causes the installer to fail.

You need to install it like:

sudo apt-get install zlib1g-dev

What worked for me was following the respective issue on the official Jekyll repository in GitHub.

Performing the following steps, I got it to work:

Remove any previously installed versions:

sudo apt-get purge jekyll
sudo apt-get purge ruby

Install ruby anew:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 
rvm install 2.4.1
rvm use 2.4.1 --default

Make sure you have, NodeJS and Python installed, if not - do so by:

sudo apt-get install node
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

And at last,

gem install jekyll

Result:

jekyll -v
jekyll 3.4.3

Of course, now you could execute gem install bundler smoothly, too.


Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM