Ubuntu 17.10无法安装Jekyll问题求助
Hey there! Let's walk through fixing your Jekyll installation issues step by step—since you already have the core packages, we'll focus on cleaning up potential mess from the wrong order and ensuring everything is properly configured.
First, let's wipe any partial or mismatched setups that might be causing issues:
- Remove all versions of Jekyll and Bundler if they're partially installed:
gem uninstall jekyll bundler -a(the-aflag removes every installed version) - Purge Ruby dev packages to start fresh:
sudo apt purge ruby-dev - Clean up leftover dependencies and cached files:
sudo apt autoremove && sudo apt clean
Step 2: Reinstall dependencies in the correct sequence
The order matters here—each package sets up the environment the next one relies on:
- Update your system's package list first:
sudo apt update - Install build essentials (this includes gcc and make, so no need to install them separately):
sudo apt install build-essential - Install Ruby and its dev package together (this guarantees they're compatible versions):
sudo apt install ruby ruby-dev - Verify everything installed correctly:
- Check Ruby version:
ruby --version - Check gem version:
gem --version - Confirm gcc is working:
gcc --version
- Check Ruby version:
Installing gems with sudo often causes permission errors later. Let's set up a local gem directory for your user:
- Create a dedicated folder for user-specific gems:
mkdir -p ~/.gem/ruby/$(ruby -e 'puts RUBY_VERSION.split(".")[0..1].join(".")') - Add these lines to your shell config file (either
~/.bashrcor~/.zshrcdepending on your shell):export GEM_HOME="$HOME/.gem/ruby/$(ruby -e 'puts RUBY_VERSION.split(".")[0..1].join(".")')" export PATH="$GEM_HOME/bin:$PATH" - Reload the shell config to apply changes:
source ~/.bashrc(orsource ~/.zshrcfor zsh users)
Step 4: Install Jekyll and Bundler properly
Now install Jekyll without sudo to avoid permission conflicts:
- Run
gem install jekyll bundler - Verify Jekyll works:
jekyll --version
Troubleshooting remaining common issues
- If you get a "command not found" error after installation, check if your PATH includes the gem binaries:
echo $PATH—you should see your~/.gem/.../bindirectory listed - If build errors pop up about missing libraries (like
libssl), install them with:sudo apt install libssl-dev libz-dev - If version conflicts persist, consider using a Ruby version manager like rbenv or rvm—it isolates your Jekyll environment from the system Ruby, eliminating most compatibility headaches
内容的提问来源于stack exchange,提问作者Frank Weslien
相关产品推荐
相关产品推荐

