Solidus: [Spree WARNING] Missing migrations - ruby-on-rails

I have a problem with Solidus 2.10.2 where when I run rails g spree:install several migration errors come up. Starting with [Spree WARNING] Missing migrations. and ending with [Spree WARNING] Run bundle exec rake railties:install:migrations to get them. but when I run bundle exec rake railties:install:migrations nothing happens...
I tried deleting the database (rails db:drop) and all my custom migration files as well before running the spree generator again however I get the same results. I put the full error in a bitbucket snippet (https://bitbucket.org/goldenBoySailsLow/workspace/snippets/5LGqez) I would appreciate any help
system info: rails 5.2.4.4, ruby 2.7.2, ImageMagick 6.9.10-23 and sqlite3 3.31.1 running on ubuntu 20.04 lts

I just had the same issue because I forgot to specify the version in the Gemfile. When I deployed, it started using solidus 2.11.2 instead of 2.10.2.
Specifying the version solved the problem for me.

Related

Redmine on Windows - error rake generate_secret_token

I am trying to follow the Redmine guide here.
I am running into the same problem this previous post, but the solution didn't solve it for me.
Steps that I have done so far:
Ruby
I have downloaded/installed the Ruby from http://rubyinstaller.org and verified that Rails was installed.
rails -v
Rails 5.1.3
ruby -v
ruby 2.3.3p222
MySQL
Visual Studio 2019 redistributable installed.
Ran the MySql installer msi
Selected the Developer (Defaults)
Took all the defaults for the rest of the wizard (I did set root password and added a user)
*I think I had to do all this first before starting the Installation procedures.
Redmine
Completed step 1-4 with the MySQL settings
Step 5
Running the command:
bundle exec rake generate_secret_token
Could not locate Gemfile or .bundle/ directory
I have verified that rake is installed
rake -V
rake, version 13.0.1
gem list rake
(rake 13.0.1)
Using the stackoverflow post from above, I did update the version of rake I had installed, but that didn't solve the issue. I am new to gem/bundle type of installs, so I may be missing something that is quite obvious.
Do I need to be a specific directory when running these commands?
Any direction for me would be good. I am trying to run this on a Windows Server if that makes any difference.
Redmine is a Rails app. You must download the app, extract it, then change into that directory before running your rake task. The process for this is defined in step 1:
Get the Redmine source code by either downloading a packaged release or checking out the code repository.
See the download page for details.
Afterwards, you can run bundle exec rake generate_secret_token because that is a Rake task defined by lib/tasks/initializers.rake. Rake tasks in Rails are typically defined within the lib/tasks directory and you can see multiple examples there.
If you attempt to run rake something then Rake is going to look for a Rakefile where this task is defined. Since you're currently just in your Ruby bin/ directory there are no defined rake tasks so you get the errors that you see.

rake aborted! ERROR: 'rake/rdoctask' is obsolete and no longer supported

I installed rails 3.2.3 in my pc but for my new project i need to work in rails 3.0.5 so I installed 3.0.5 version of rails and now when i write any rake command i get the following error
rake aborted! ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
currently this rake version is installed in my pc rake (10.1.0)
I know the error says everything but im new in ruby and rails. So i don't understand what to do. I googled it but most of the solutions ask to update rails
I know the error says everything but im new in ruby and rails. So i don't understand what to do. I googled it but most of the solutions ask to update rails
That's unfortunately the best solution. You are using a very old version of Rails that was based on some conventions of the time. Rake has changed and 10.0 is no longer compatible with that Rails version.
You should install a previous rake version. 0.9.0 should be sufficient.
In your Gemfile set
gem 'rake', '0.9.0'
then run $ bundle. Make sure you will prefix every command with
bundle exec
such as
bundle exec rake -T
instead of
rake -T
otherwise the script will fall back again using the most recent version of Rails on your machine.
For your reference, the reason of the error is probably caused by the documentation.rake file that at the very beginning it includes a deprecated rake file, removed in GH-1301.
Keep in mind that, assuming the app will then run, your first goal should be to upgrade your app. In fact, if you try to use it as it is, it's likely you will encounter so many other incompatibilities.
That was fairly simple to debug (assuming you have a reasonable knowledge of Ruby and Rails internals), but others may be harder or even impossible to fix forcing you to nothing else than upgrade.

undefined method `action_mailer' during Capistrano deployment

I'm having this error message come up during Capistrano deployment. It implies to me that something's wrong with Rails being installed or something? Rails is not currently installed on the server side, but it's in my Gemfile (and my Gemfile.lock), so I'm assuming it should be installed during the bundle install command that gets executed before this line.
The actual command that's giving the error is:
bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile
I guess the problem is just that Rails is not being installed during the bundle install. Am I missing something?
Thanks!
UPDATE 1: Rails appears to be installing correctly via the bundle install command. If I check out the directory .../shared/bundle/ruby/1.9.1/gems, I can see action mailer in there.
UPDATE 2: Running the command rake assets:precompile actually fails locally as well, so this doesn't have anything to do with Capistrano it would appear. Now I just have to figure out why the config object doesn't know anything about action mailer?
UPDATE 3: Hot on the trail. It looks like my installed version of actionmailer is 0.6.1 (?!), meanwhile all the rest of my Rails stuff is up at 3.2.9. bundle update refuses to update actionmailer past this version. I'm going to remove all of my gems and start fresh.
UPDATE 4: Deleted my entire gemset using rvm gemset empty. Then tried to run bundle again, and again it tries to get actionmailer 0.6.1. I think something is screwed up with bundler or something...
The problem ended up being that I had removed a dependency upon a specific version of Rails in my Gemfile. I just had gem "rails" in there. That seemed to completely botch the dependency calculations, because it was getting super-old versions of action mailer rather than getting a consistent version from all gems. Guess it's a bad idea to not specify an exact Rails version. Yikes!
#aardvarkk,
Thanks for posting this issue, I was having the same error with my installation of Rails 4.0.0 and the error was preventing me from running my rails server
This is while I'm trying to follow the Hartl Tutorial for RoR.
I added gem "rails", '4.0.0' to my gem file and now I'm able to run my rails server.
Thank you

How to run a specific version of rake

Background:
I get errors whenever I run rake in an older project. (uninitialized constant Rake::DSL).
The rails project in question is an old project that was started with Rails 2.1 (I think), and since then I've updated the OS on my laptop a couple of times, and made updates along the way to make it run.
Right now, the rails app works fine, provided I have RAILS_GEM_VERSION set to 2.3.5. I'm not sure if the app was completely updated to Rails 2.3.5.
There is no Gemfile in my older project.
If I create a brand-new rails project (and unset RAILS_GEM_VERSION), rake runs fine.
My question: To troubleshoot, I'd like to try newer versions of rake. I'd like to know how to force one specific version to be used, since it appears I have multiple versions installed.
Info on my environment:
$ gem list rake
*** LOCAL GEMS ***
rake (0.9.2.2, 0.9.2, 0.8.7, 0.8.3)
$ rake --version
rake, version 0.8.7
So it looks like it's picking up the 0.8.7 version.
All the help files online seem to tell me to specify the rake version in the Gemfile, but there isn't one in this project. (Maybe it predates gemfiles?)
If I unset the RAILS_GEM_ENVIRONMENT variable altogether, and try to run rake, I get:
rake aborted!
can't activate rails (= 2.3.5, runtime) for [], already activated rails-3.2.8 for []
None of the environment config files in my older project set that variable either.
This may be of help. Have you tried the underscore solution?
Example:
rake _0.9.2_
you can run rake specific version by using this
bundle exec rake ...
more detail see this - bundle exec, rake
You can uninstall the current version of rake and install another desired version using commands similar to the following:
gem uninstall rake 12.3.1
gem install rake 10.5.0
(Note: you might need to run as sudo for permissions)
I had a problem where I received the following error while trying to install rake 10.5.0:
Could not find a valid gem '0.8.7' (>= 0) in any repository
I resolved this problem by adding the following line to my Gemfile:
gem 'rake', ' <11.0'
After editing Gemfile I was able to successfully downgrade rake by updating my gems:
bundle update

Ruby on Rails 3 simple-navigation could not find in any of the sources

I've be using simple-navigation and it's working fine. I've just tried to do a database migration using:
rake db:migrate
and get the error:
test me$ rake db:migrate
(in /Users/me/test)
Could not find simple-navigation-3.2.0 in any of the sources
Try running bundle install.
I've run bundle install and I have a working navigation in the application. Running the db migration is the only problem I'm having.
Any ideas?
Turns out it was a problem with my environment. I installed rvm and installed the latest version of Ruby and everything works fine now.

Resources