All threads / Struggling to get rails working
Ask A Question

Notifications

You’re not receiving notifications from this thread.

Struggling to get rails working

sam asked in Rails

If I use "sudo gem install rails", it says everything is installed

Then I hit "rbenv rehash" and try to create a new project. The CLI gives me the error:

Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

If I don't use "sudo" I get:

ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_rmdir - /usr/local/lib/ruby/gems/2.7.0/gems/actioncable-6.0.3.2

What's going on? How can I start again?

I feel like it's not looking in the right place to find rails

I changed the permissions on the directories and it no longer throws the ERROR message:

$ sudo chown -R $(whoami) /usr/local/lib/ruby/gems/*

However,
$ rails new project

Still throws:
"Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails"

There is Ruby 2.6.0 (/usr/lib/ruby/) and Ruby 2.7.1 (/.rbenv/versions/2.7.1/lib/ruby/) installed on my machine.

It could be pointing to 2.6.0 instead of 2.7.1, it looks like the gems are installed properly on the 2.7.1 version

Webpacker successfully installed!!

I don't know what happened but I uninstalled rbenv in brew and reinstalled in, reran the doctor and it seemed to work:

This page was immensely helpful - https://github.com/rbenv/rbenv#locating-the-ruby-installation

I was about to turf it all and setup a venv

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 66,029+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.