February 18, 2017

Fedora 25 -- Rails

I have a rails project. It is my way of having a GUI frontend to a database of mineral specimens. I keep the project in /u1/micromounts. The database itself is in db/development.sqlite3

After my fresh install

I start this up via "rails server", but I am not going to attempt that until I fix some things. The fedora install has put "gem" in the bin directory (but curiously enough, not rails). Well I probably got gem when I earlier did "dnf install ruby". This confronts me with about 3 choices to get rails itself: The last choice seems fine (and "gem" seems to place things into my local bin directory, so this is equivalent to the second option anyway).
gem install bundle
Fetching: bundler-1.14.4.gem (100%)
2 gems installed
which bundle
~/bin/bundle
Bundle has made it much easier to keep this old project running. It will find and try to build the exact versions of rails components that I orignally developed the project with. I know from past experience that I need to install certain "-devel" packages to get header files for some things that will get built:
su
dnf install ruby-devel
dnf install sqlite-devel
dnf install nodejs
dnf install redhat-rpm-config
exit
cd /u1/micromounts
bundle update
rails server
After this I can point my browser to localhost:3000 and see the page I expect!

Unexpected troubles

This is all a matter of missing packages, which I have tracked down and added to the list above. I have the details here so that other folks may wind up here via Google searches and find helpful tips perhaps.

Bundle install gets into trouble building "json (1.8.6)" (which I am not sure I even need anyway). I get this message:

gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
The fix is apparently to install the "redhat-rpm-config" package as I have now added above. A google search on the error message led me quickly to this helpful page: Running "bundle install" is typically a "lather rinse repeat" scenario, adding packages until things build. It is certainly much less painful than it used to be.

Once the "bundle install" succeeds, I try "rails server" and get a long traceback with the following error:

Gem Load Error is: Could not find a JavaScript runtime ...
The fix to this is to install nodejs, as I have added to the list above.


Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org