I keep getting this message when trying to spin the server in rails.
to_specs': Could not find 'activesupport' (= 6.0.0) - did find: [activesupport-5.2.2.1] (Gem::MissingSpecVersionError)
Checked in 'GEM_PATH=/home/louis/.gem/ruby/2.5.0:/var/lib/gems/2.5.0:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.5.0:/usr/share/rubygems-integration/2.5.0:/usr/share/rubygems-integration/all', execute `gem env` for more information
I have tried uninstalling and reinstalling the gem, but I am wondering why my app is even expecting version 6.0.0, I am running rails 5.2.2.1 (and have to keep it that way) does anyone know what is happening and how I can resolve it.
Side note: I am using commands gem such and such rather than bundle for various reasons
Response to comments: The reason for not using bundle is because when I was using bundle to manage my dependencies for work, it was mismanaging the gems I had globally- so If I made a practice project and bundled, it would also change the gems for the project I work on professionally and cause conflicts- so now bundle has a different environment to my work project so I can create mini rails apps in my spare time. How do I remedy this situation? Many Thanks
can you pass the gemfile and gemfile.lock?
You have to bundle.
This will install gems and resolve dependencies.
Related
I'm trying to create my first rails app. I'm on a Macbook Pro, so macOS.
I've been following this guide setting up rbenv, rails etc.
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-macos
Then I'm following a crash course on YouTube. In the terminal I try to create a new rails app
rails new foodlog
It starts to set up in the folder I made for it, but the following happens during setup
Bundler::PermissionError: There was an error whle trying to create
'/Users/myusername/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0/racc-1.6.0'.
It is likely that you need to grand executable permissions for all parent directories and write permissions for
/Users/myusername/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0'
This error continues repeating the same thing with things such as "strscan".
Then after it says
In gemfile:
rails was resolved to 7.0.3.1, which depends on
actionmailbox was resolved to 7.0.3.1, which depends on
net-imp was resolved to 0.2.3, which depends on
stscan
run bundle binstubs bundler
Could not find gem 'sprockets-rails' in locally installed gems.
rails importmap:install
Could not find gem 'sprockets-rails' in locally installed gems.
Run 'bundle install' to install missing gems.
rails turbo:install stimulus:install
Could not find gem 'sprockets-rails' in locally installed gems.
Run 'bundle install' to install missing gems
I've tried looking online, coming across similar but not exact issues. For example, one solution suggested doing bundle install in this directory, versus where the guide says do it in the home directory. So I do that and get
Bundle complete! 0 gemfile dependencies, 1 gem now installed.
Still doesn't do anything. I think the main culprit is the permissions error it mentions above? This is my first time trying to really do any development on the macOS and I'm sure there's just a misunderstanding somewhere regarding permissions, so if anyone can help that would be appreciated!
It is likely that you need to grand executable permissions for all parent directories and write permissions for
/Users/myusername/.rbenv/versions/2.7.5/lib/ruby/gems/2.7.0/extensions/arm64-darwin-21/2.7.0'
Your question does not mention, so I think you might have missed this suggestion. Make sure all directories have the executable permission
I'm new to rails and trying to do some playing around with gems and such.
My case here is that I have this navigation menu on my website and I needed to get the current_page link selected.. rather than building a helper I wanted to install a gem so I went and looked for one and found this one.
I then followed what the documentation said:
In my gemfile I added
gem 'rack_current_page'
Then in the project root config.ru
require ::File.expand_path('../config/environment', __FILE__)
use Rack::CurrentPage
run Rails.application
And finally I ran:
bundle and rails s only to find out I had this error:
uninitialized constant Sprockets::SassCacheStore
The error happens when including the application stylesheet in the layout file.
I'm using the following packages / versions (only listing what might have impact - if I'm missing something let me know)
(<gem> -v)
Rails 4.2.1
Sprockets 3.0.0
Sass 3.4.13
Rack 1.5
While doing the uninstall I removed every line I added - heck I also reset my project files to head since I just started working on it anyways,
ran a fresh bundle, restarted the server, checked the site but all I'm getting is the error above..
I googled and tried to look for a similar question on SO but couldn't find any so the only thing I could really try was the uninstall and reset my git.
I'm definitely looking over something really stupid but can't really find the answer so here I am ;)
Any help is appriciated, thanks in advance and comment if I missed info that you guys need.
time of writing
I actually did a quick gem pristine --all with no results either.
EDIT 1
Okay, so with abit of guesswork and the same situation happening before resulting in the recreation of a fresh app in the (short) past I uninstalled the compass-rails gem and ran bundle afterwhich rails s to test if things started working.
It did. Then I went on and reinstalled compass-rails and it kept working... getting quite confused now :S
Okay so here goes:
I've found the problem and it was solved by actually supplying a version that works with rails 4.2.
The default gem compass-rails installs a version incompatible with sprockets.
When I added the specific version as seen here and ran another bundle the versions of most of the packages I named in the question changed.
console output after gemfile modification included:
Installing sprockets 2.12.3 (was 3.0.0)
Using sprockets-rails 2.3.1 (was 2.2.4)
Installing sass-rails 5.0.1 (was 5.0.3)
Installing compass-rails 2.0.4 (was 2.0.1)
Guess it's just waiting for compass to release a compatible version.
I just tried deploying my app to Heroku. It's been working for quite a while, I am just adding some new features. Once I deployed, I got an "App Crashed" error. heroku logs showed No such file to load -- nokogiri (LoadError).
Now, on my system, my Gemfile.lock showed 2 different nokogiri gems: nokogiri (~> 1.5.0), a dependency of fog (1.4.0) and nokogiri (1.5.5-x86-mingw32) which doesn't appear to be a dependency of anything. Under platforms was only x86-mingw32. My development computer is Windows 7 with ruby 1.9.3p194 and the Ruby version that the Heroku toolbalt uses for itself is heroku-toolbelt/2.30.1 (i386-mingw32) ruby/1.9.2.
My version of Bundler was up to date, my version of the Heroku toolbelt was up to date. I tried deleting Gemfile.lock and re-deploying on the advice of some forum posts, but the app was still crashed.
It appears that Heroku was simply not bundling in the right version of nokogiri, but was ignoring it on account of my use of Windows. The way I got to to be fixed was I added gem 'nokogiri', '~> 1.5.5' to my gemfile (even though my app does not explicitly need nokogiri, it is only a dependency) and then re-deployed to Heroku without running bundle install on my own system first. Now the app does not crash.
I have no idea why this worked. I don't know how to ensure the problem doesn't occur again, I just happened to get lucky with a desperate patch. I can't have this downtime in the future, or worry about something like this happening again for a routine deploy. Can someone please explain what was actually wrong and the right way to solve it?
Add this
PLATFORMS
x86-mingw32
to your Gemfile. Heroku will then ignore your Gemfile.lock because windows has crazy different dependencies.
I ran into some problem with passenger on Dreamhost after installing refinerycms with its blog plugin. The rack just failed without any information about the
problem, It only said "... please check the server log ... " and a stack trace
without any message about the error.
After a while trying to reinstall but failed, running in the same problem. I finally have it work by doing 2 steps:
1) bundle install --deployment
==> It now shows the error about the differences in Rack version, my required 1.2.4 but it's 1.2.1 configured.
( I did 'bundle install' before but not solve the problem of rack )
2) I googled and update my Gemfile.lock to 1.2.4
AND IT WORKS ... LIKE MAGIC...
Can someone explain to me :
what did "bundle install --deployment" do differently from
"bundle install" ?
What's "Gemfile" and "Gemfile.lock" different ?
Any idea why It would work if I do like above ?
Thanks a lot
Rails 3's "bundle install" and "bundle install --deployment" both work well except the 2nd one just uses more disk space?
Gemfile keeps track of what gems are necessary and Gemfile.lock also keeps track of all your gems' dependencies
Regarding #3, Dreamhost basically requires rack 1.2.1, which you would normally set by having a line like this in your Gemfile:
gem "rack", "=1.2.1"
I assume that hacking the version into Gemfile.lock works because it is installed on the system already, so your app is able to load it without any problems. But it would certainly be better to just specify it in your Gemfile.
Getting rack-based apps running on Dreamhost can be a bit of a trial. If you continue to have problems, you will probably need to post some more details about your config and any specific errors you're getting.
I have a project where I used to have simple_captcha gem but no more. All traces removed. I even cleaned the directory and added a new project, even though the bundler installs all gems into a local path called simple_captcha. I have also uninstalled the gem from the system.
Anyone had this problem before?
It is possible that one of your other gems depends on simple_captcha.
Look into Gemfile.lock, there you can see which gem requires simple_captcha.