Discourse - Ruby 2.0 / Rails 4?

I know this is not the right type of question for Stack Overflow (please forgive me), but I’ve spent hours trying to get Discourse to run on my machine. It was working before, but I upgraded to Ruby 2.0 and Rails 4 and now I simply can’t get it working due to various errors (mounting NFS, Syck deprecated, TheRubyRacer not installing properly).

I tackled these one by one, and now when I SSH into vagrant it says cannot find the gemfile when I do bundle install. I think I may have altered something and it’s not “SSH-ing” into the proper folder, but I did a lot of things based on what I googled / found on stackoverflow and am kind of stuck.

I know this is a very vague / poorly structured question, but I’m still new to programming and just wondering, does Discourse work with Ruby 2.0/Rails 4 and can someone point me in the right direction regarding how to tell if I somehow broke my SSH command?

Discourse Ruby and Rails Requirements

Discourse does not support arbitrary Ruby or Rails versions. As of most stable versions:

  • Ruby 2.7.x is supported (NOT 2.0).
  • Rails is pinned inside Discourse’s Gemfile.lock — you should not upgrade Rails manually.
  • Do NOT use Ruby 2.0 or Rails 4 — that’s way too old or incompatible now.

Solution: Use the recommended Ruby version for Discourse. Run:

cd /vagrant/discourse
cat .ruby-version

This tells you what version Discourse wants. Then use a version manager like rbenv or rvm to switch to that version:

rbenv install 2.7.6
rbenv global 2.7.6

2. Gemfile Not Found in Vagrant

If you’re SSH-ing into Vagrant and running bundle install, but it says:

Could not locate Gemfile

That means you’re not in the right working directory.

Solution: Run:

pwd

and ensure you’re in the /vagrant/discourse directory (or wherever your Discourse source code is).

If not, navigate to it:

cd /vagrant/discourse

Make sure a Gemfile exists:

ls

3. TheRubyRacer Not Installing

Discourse does not require therubyracer anymore in newer versions. You can ignore this.

If you’re using an older version or still see it in the Gemfile, remove the line:

gem 'therubyracer'

4. NFS Mount Errors

If you’re using Vagrant and see NFS mount errors, it usually means:

  • You’re on Windows without proper NFS support.
  • Or your Vagrantfile has config.vm.synced_folder using nfs.

Solution: Either:

  • Remove nfs: true from your Vagrantfile, or
  • Install an NFS service (on Windows, you can use something like winnfsd or change the sync type to rsync)

General Discourse Setup Advice

Instead of using Vagrant or manually upgrading Ruby/Rails, follow the official setup guide:

= https://github.com/discourse/discourse/blob/main/docs/DEV-ENVIRONMENT.md

They recommend using:

  • Docker-based setup (simpler)
  • Or discourse_dev script on macOS/Linux

Summary

  • Use the exact Ruby version specified in .ruby-version
  • Never upgrade Rails manually for Discourse
  • Make sure you’re in the right directory when SSH-ing into Vagrant
  • Use Discourse’s official setup guide for development
  • Therubyracer is no longer required
  • Avoid NFS on Windows or use rsync instead