Working with chruby and nvm on Ubuntu
I am setting up a new Ubuntu 16.04 dev environment. I wanted to take some notes on my progress. I am trying out chruby after it being highly recommended by the ruby gurus Eric and Zach. A natural place to start would be to get this Jekyll blog running locally. I ran into a few stumbling blocks.
Installing chruby and a Ruby version
There are many different ways to do this, I chose the method below.- Download and Install chruby
wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz tar xf chruby-0.3.9.tar.gz cd chruby-0.3.9/ sudo make install
- Add chruby to your .bashrc
source /usr/local/share/chruby/chruby.sh source /usr/local/share/chruby/auto.sh
- Install dependencies
sudo apt-get install -y build-essential bison zlib1g-dev \ libyaml-dev libssl-dev libgdbm-dev libreadline-dev \ libncurses5-dev libffi-dev
- Install Ruby 2.3.1 This will work for any version of Ruby, but 2.3.1 is the one that I needed.
wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2 tar xf ruby-2.3.1.tar.bz2 cd ruby-2.3.1/ ./configure --prefix=/opt/rubies/ruby-2.3.1 make sudo make install
- Install Gems for Jekyll Now that we have Ruby installed, we can install bundler and install all of our Gems.
chruby 2.3.1 gem install bundle bundle install
/home/levlaz/.gem/ruby/2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:89:in
`rescue in block (2 levels) in require': There was an error while trying to load
the gem 'jekyll-coffeescript'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See
https://github.com/rails/execjs for a list of available runtimes.
Since I often work with many different versions of node, I took the opportunity to install nvm rather than the version of node that is available in the Ubuntu repositories.
Installing nvm
nvm is a really nice tool for working with various versions of node.- Run the installer script
This will install nvm and add the appropriate lines to yourcurl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.7/install.sh | bash
~/.bashrc
file in order to load properly. - Install the latest version of node
nvm install node
- Source NVM To get nvm working in the same terminal, you can run
source ~/.bashrc
, alternatively you can open a new terminal and nvm will automatically be sourced since the installer script added the appropriate bits for us.
jekyll -s
. Not only do we have Jekyll running like a charm, we also are ready to work with any version of Ruby or Node with chruby and nvm.
Thank you for reading! Share your thoughts with me on mastodon or via email.
Check out some more stuff to read down below.
Most popular posts this month
- Dagger Feels Like Magic
- Now What?
- SQLite DB Migrations with PRAGMA user_version
- 20 Years of Ubuntu
- Types and Roles If Not Exists in PostgreSQL
Recent Favorite Blog Posts
This is a collection of the last 8 posts that I bookmarked.
- We don’t need to use what we make from Derek Sivers blog
- Ubuntu Summit 2024: A joyful experience filled with sorrow from Planet KDE | English
- Sabotage from jwz
- What if My Tribe Is Wrong? from Armin Ronacher's Thoughts and Writings
- It’s the “1998” of the AI Revolution. So Why Can I Safely Ignore It? from The Internet Review
- University & Adversity from Isaak.net
- War on Malaria from Isaak.net
- Serendipity from Armin Ronacher's Thoughts and Writings
Articles from blogs I follow around the net
Ozempic For Sleep
Thanks for key conversations & early feedback: Andrew Payne, Luke Piette, George Church, Michael Retchin, Flora Guo, Merrick Smela, Misha Yagudin, Tyler Cowen, Helena Rosengarten. My favorite family in the world — the Johnsons from Utah. Many of them c…
via Isaak.net November 11, 2024Navigations on the Web
When trying to define the difference between a link (<a>) and a button (<button>), a general rule of thumb is: links are for navigation, buttons are not. That can take you pretty far. However, like most things, there’s nuance and that mental mo…
via Jim Nielsen’s Blog November 11, 2024Too much therapy at work
Many years ago, Jason and I hired a COO at 37signals, but ended up letting them go after just a year (many reasons, another story). This happened not long before one of our company meet-ups, so we thought it fitting to discuss the matter in-person. What…
via David Heinemeier Hansson November 11, 2024Generated by openring