I don't really know where to turn on this one. Due to an unfortunate situation, I'm in the middle of a rebase which is trying to add ember to a project while upgrading to rails 4.1 and ruby 2.1.1 at the same time (the rails and ruby upgrades were merged into the project while I was on the add ember branch). I'm getting all sorts of dependency errors when trying to get a rails server up.
Some of the errors included:
bin/rails:8: warning: already initialized constant APP_PATH
/home/amax/git/forever/bin/rails:8: warning: previous definition of APP_PATH was here
cannot load such file -- websocket/driver
cannot load such file -- active_model_serializers
One thing I noticed was that my rvm path has 2.1.1 and 2.1.0 in it which I'm guessing is a bad sign. I'm thinking it may be loading old gems
root/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems.....
Does anyone know if this could cause problems and any suggestions on a possible remedy?
The errors seemed to change every time and it seemed to be the fault of an irredeemably screwed up gemfile.lock that I caused during the rebase.
I started from a new branch with rails 4.1.1, added ember to it and then copied and pasted that working gemfile.lock over the broken one which resolved all of the issues. If you get into a similar situation I think it may be worth a try to blast away your gemfile and gemfile.lock and recreate them in a stable environment
Related
I am setting a new app, stack is:
ruby: 2.6.1 (using rvm)
rails: 5.2.2
bundler: 2.0.1
Now thing is, bundler 2 doesn't use Gemfile at all, i have proper gems.rb and gems.locked and everything was working properly until i pulled some code from a co-worker which got merged.
Issue is whenever i run any rake or rails command i get this error:
/path/to/proj/Gemfile not found
I then even tried going back to old master when that code was not merged and issue is still there. So it is probably not something in the code i pulled.
And issue seems persistent in different machines.
I know there are other issues which have similar errors of Gemfile not found but those are mostly those which had wrong directory opened or some gem issued fixed by bundle update or gem update type commands, this is not that issue because. This is something else, because bundler 2 doesn't even need Gemfile.
It looks like rails doesn't support using gems.rb and gems.locked. https://github.com/rails/rails/issues/31295
You could try what that guy did and edit some files, or you could rename your gems.rb back to Gemfile and gems.locked back to Gemfile.lock
I got the issue multiple times that I can't run a rails project because I get the message from rubymine:
gem 'yada yada' is not available in the project sdk ruby version xxx.
... is there a way to find out the right Ruby version to use from the gemfile, even if someone does not specify it explicitly in the gemfile?
Concretely I can't run the following projects if s.o. wants to help here... (1) https://github.com/becky000/sample_app
[2] https://github.com/lobsters/lobsters
[3] https://github.com/paulorja/rts-web-rails
Maybe someone gets the same issues while trying these ones to get to run.
The lobster app has a .ruby-version file in its root which is a common way to declare the Ruby version the app is depending on.
For the others apps, you will probably need to contact the maintainers or investigate on Rubygems the dependencies for every gem that fails to install (e.q. yada yada).
I can't seem to find this simple yes no question online so sorry for the super noob question!
I'm using an EC2 instance for my development and I set it up to have ruby 2.1.1 and rails 4.1. I have RVM, but don't actually have any other ruby versions.
I cloned my friends project and told him I would start helping him. His project is a ruby 2.0 and rails 4.0.4.
He's concerned that when I merge changes it will update the project to 2.1.1 and rails 4.1 and then it will crash on his computer (since he doesn't have 2.1.1 or rails 4.1)
I don't think this is the case, but I'm not 100% sure, so how valid are his concerns? I was under the assumption that as long as I don't use any functionality from rails 4.1 and 2.1.1 that isn't in 4.0.4 or 2.0.0 then there is no need to be concerned. Also, I assume when I cloned the project and make changes to it, it should stay in 4.0.4 and 2.0.0 versions. Is that true?
Thanks for any clarification!
The Rails version should be defined in Gemfile, so unless you change it, it will stay the same (and when you run bundle install the proper version will be installed if it's missing, so even on your computer you will not work on Rails 4.1, but on Rails 4.0.4).
With Ruby version it's a bit more complicated, because it can be defined in some file (like .rvmrc or .ruby-version), but does not have to. Still, if you don't change anything in project's configuration, neither Ruby nor Rails version will be changed.
If you are physically merging a 4.1 into the 4.0.4, then you will most likely encounter some issues. (I don't know the exact differences between those versions, but a full minor version up usually comes with new/changed goodies)
If you are just working on each app separately, then they would be isolated by their Gemfile. This is assuming the Gemfile.lock has been saved into the repo. Or the versions have been locked in the Gemfile itself.
Your Ruby version probably won't matter if you are running the bundle install fresh on your current version. Unless there are specific needs for a specific version.
I am facing issue when I am trying to work with rails 3.0.11. I initially worked with rails 3.2.6. Build a prototype application in Rails 3.2.6, Ruby 1.9.2 and gem 1.8.7. But then found, server on which we need to host is a shared server which can only support Rails 3.0.11, Ruby 1.8.7 and gem 1.7.2.
Hence I want to keep my dev environment exactly same before I ran into further issues. As I found there was some discrepancy in routes.rb of both the versions.
Steps I followed:
Uninstalled rails
Uninstalled ruby
Installed ruby from here.
This installed ruby version 1.8.7-p370 and gem 1.8.7
After this I installed rails by specifying version as 3.0.11
But still when I run command rails -v, it throws an error to me saying 'missing gem rails 3.2.6. Run bundle install to resolve the issue'
When I ran bundle install, it again completely installed rails 3.2.6 and problem remained unresolved.
Please suggest the clean way how shall I start my development on rails 3.0.11 without running into any issues?? Am I need to delete some registry or mapping in my system through which it is detecting rails 3.2.6 and creating issues??
Its urgent as I need to complete my dev by 7th September.
As I am new to stackexchange, please guide is it appropriate to ask question on the same related thread or shall I open new discussion for my problem?
#Gun - please note in response to one of your comments posted above - you DO need to change your Gemfile - if you are running rails -v from withing your project's directory, it will read the Gemfile.
There is a script located at script/rails - this is what runs when you run the rails command from the project directory. NOTE that this rails script requires your config/application.rb file - which in turn reads the Gemfile and bundles the referenced gems. Thus is your Gemfile still references 3.2.6, and it is not installed, rails -v will not work
Glad to hear the problem is fixed :)
As for the asset pipeline - if you are using rails 3.2.6 (or were using it) then you may have been using the asset pipeline to serve your assets (javascript files, CSS files, images, etc). If you were, and you downgrade to anything pre rails version 3.1, then anything being served through the asset pipeline will no longer work.
Here is a pretty good description of the asset pipeline: http://guides.rubyonrails.org/asset_pipeline.html
You should check also remove your Gemfile.lock or manually 'bundle update rails' when you change your rails dependency.
I suggest to use rbenv or rvm to create a virtual environment/sandbox where you can install your preferred ruby versions (e.g. 1.8.7) and keep tracking of your dependencies separately. This would save you a lot of effort.
Keep in mind that rails 3.0 has no asset pipeline support (it has been included in rails 3.1)! This is a very important difference and if you depend on it you will have big issues to solve for the downgrade.
Thanks a lot everyone for help.
I believe it was weird issue. I had heroku on the system. I was initially deploying my app on the same and then changed to another hosting server.
After uninstalling the heroku, it works perfectly fine. Probably, that was interfering somewhere. Although, not sure but problem is resolved.
Thanks a lot again for a great great help!!!
Meanwhile, I would request alup to throw some more light on asset pipeline support. Wots that? Could you please explain more??
Need to delete C:\Users\.ror folder and C:\Users\.gemfile and C:\Users\.gemfile.lock from your desktop..
I have a rails application that I deploy on Heroku. I'm using several different machines, and I noticed that when I add new dependencies (so that Gemfile.lock is rebuilt) and do bundle install on my Windows computer at home, push to Heroku fails with the following error:
Unresolved dependencies detected; Installing...
Windows Gemfile.lock detected, ignoring it.
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
...
Gemfile.lock IS under version control, but Heroku appearently chooses to ignore it since it's created in Windows, and then complains that it's missing seconds later. Why does this happen? And how can I solve it?
I fixed mine by opening Gemfile.lock and deleting the following two lines:
PLATFORMS
x86-mingw32
So now i just need to make a script that bundles then removes that from the lock file.
Like matt commented above:
The problem is that Bundler creates different Gemfile.locks for Windows. The only solution is to create and commit the lock file on a *NIX system.
I would suggest to create a virtual machine running e.g. Ubuntu – maybe using Virtual Box. You can even get ready-to-use virtual machines – for example here.
From the Heroku Docs:
If the platforms section of your Gemfile contains Windows entries,
such as mswin or mingw, then the Gemfile.lock file will be ignored.
Just battled through this problem for a while.
I trimmed my gemfile back to just rails and still had the issue. Then, thinking that heroku had demanded an update of the heroku gem today, I looked closer at heroku changes.
It seems the 1.9.2 ruby "bamboo" stack is now the default one - my app is still running on the 1.8.7 stack. So I ran "heroku stack:migrate bamboo-mri-1.9.2" and updated the stack to 1.9.2 - not something I wanted to do, but you know what, it fixed the issue above.
Of course, I didn't want to be on the 1.9.2 stack, so I migrated back down to the 1.8.7 stack, and things installed correctly again. So I think this is a workaround - and probably an overly complex one - but it seemed to "flush" whatever the error was heroku-side. As nothing I did locally (and I tried a LOT of things from StackOverflow articles) had any effect, the push just kept failing as above.
So yeah, this fixes it. Doesn't take too long either. But suspect a better workaround may be spotted by more heroku-knowledgeable developers !
Make sure you commit the changes to Gemfile.lock after installing the bundle. On your next push to Heroku, the new gems should be installed correctly.