0

Hello I'm learning by book Ruby on Rails Tutorial. According on Tutorial I tried to install Gemfile from Tutorial, but I faced up some problems when I try to run

bundle install

  1. First problem is

It is likely that you need to grant write permissions for that path.

Then I solved it by this topic

  1. Second problem was

Could not find sassc-2.4.0 in any of the sources

 `Building native extensions. This could take a while...ERROR: Error installing sassc:ERROR: Failed to build gem native extension.current directory: /var/lib/gems/2.5.0/gems/sassc-2.4.0/ext/usr/bin/ruby2.5` 
  1. Now I have

    3: from /var/lib/gems/2.5.0/gems/bundler-2.2.12/lib/bundler/source/metadata.rb:7:in specs' 2: from /var/lib/gems/2.5.0/gems/bundler-2.2.12/lib/bundler/index.rb:9:in build' 1: from /var/lib/gems/2.5.0/gems/bundler-2.2.12/lib/bundler/source/metadata.rb:28:in block in specs' /var/lib/gems/2.5.0/gems/bundler-2.2.12/lib/bundler/rubygems_integration.rb:588:in find_name': undefined method `stubs_for' for Gem::Spec

My OS - Linux mint 19.1 Ruby v - 2.5.1 Rails v - 6.1.3

4
  • For what it's worth, I copied your Gemfile and it installed without issues. It sounds to me like you've got a dodgy ruby installation, possibly because the tutorial you ran something as sudo and then tried to fix permissions retrospectively?? Commented Mar 3, 2021 at 13:11
  • I can see other people have encountered that exact error before, so you could try their solution. Or, it might be easier to just uninstall ruby and start again without running anything dodgy with chmod or sudo? Commented Mar 3, 2021 at 13:13
  • I have tried all this solutions, but I think you are right. It is easier to just uninstall and start it again Commented Mar 3, 2021 at 14:15
  • I'd recommend to install and or use a ruby version manager, rvm or rbenv are good start points. rbenv is my personal choice. Installing development gems with sudo (system-wide) is not a very good idea. Commented Mar 3, 2021 at 19:03

1 Answer 1

0

There are several possible issues:

  1. you may have used bundler as root in which case the file ownerhip expected by bundler will be incorrect.
  2. your version of gem is probably out of date, and you have not run gem update -system to update it.

You may also be missing the ruby-dev package. This contains the c/c++ headers requied to compile some native gem extensions. You may also need other libraries such as libstdc++ etc.

Sign up to request clarification or add additional context in comments.

2 Comments

I have updated gem and Installed ruby-dev. My problems are still here. Is it a good idea to reinstall all packages? I think I've made a mistake when used bundler with sudo and used this code chown -R fil ~/.bundle/cache
It's probably best to start over, yes. Install ruby as root on the system, but install bundler etc as the user you are intending to run the application as.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.