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.
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.
I am facing a error when I run any migration as:
raj#notebook-pc:~/Desktop/Projects/invoicemanagement$ rails g migration RemoveDescriptionOfGoodsFromInvoiceDetails description_of_goods:string
Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
/var/lib/gems/1.9.1/gems/bundler-1.9.0/lib/bundler/runtime.rb:34:in `block in setup': You have already activated spring 1.3.3, but your Gemfile requires spring 1.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /var/lib/gems/1.9.1/gems/bundler-1.9.0/lib/bundler/runtime.rb:19:in `setup'
** 11 stack trace lines skipped **
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
So with some googling I run bundle update spring, which solved the above error, and I am able to remove/add migrations. Again if I run rake db:migrate, I am getting error as:
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `to_sym' for nil:NilClass/var/lib/gems/1.9.1/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:216:in `column'
** 33 stack trace lines skipped **
/var/lib/gems/1.9.1/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
Please help me.
After running bundle update and updating Spring, I was getting the following error when running the console:
There is a version mismatch between the spring client and the server.
You should restart the server and make sure to use the same version.
CLIENT: 1.3.4, SERVER: 1.3.3
I followed the recommendations in this Github issue and ran:
spring stop
This fixed the issue for me.
try running "bundle update" in your terminal, then try "rails console" again as usual - i had this same issue , running bundle update first fixed it for me!
Run: ps aux | grep spring, then kill the spring process.
It worked for me.
I had a similar problem trying to run rails commands outside of my docker container.
In my case, my Gemfile.lock file said to use Spring (1.3.4), but the error message said my server was running version 1.3.5. Prepending my command with bundle exec didn't make any difference either. By running
gem list | grep spring
I noticed I had multiple versions installed. After I ran
gem uninstall spring -v '1.3.5'
and bundle again, it worked perfectly.
Who knows, I may have needed the newer version for some other project at some time.
This happens because one of the dependencies of your project is an older version of Spring than is installed on your system:
You have already activated spring 1.3.3, but your Gemfile requires spring 1.3.2. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
The correct way to deal with this is to prepend bundle exec to your command, as the error message indicates. Please see below:
When running an executable, ALWAYS use bundle exec [command]. Quoting from the bundler documentation: In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle. However, this is unreliable and is the source of considerable pain.
http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/
Running bundle update can cause some other issues. If your second error persists, you might want to revert to your old Gemfile from version control.
Stop the spring server
spring stop
I installed 'dynamic_form' gem in my rails 4.1.4 app. When I tried to run console (bundle exec rails console) I get the error below:
$ bundle exec rails console
Could not find dynamic_form-1.1.4 in any of the sources
Run `bundle install` to install missing gems.
But when I run server (bundle exec rails server) seems to work just fine.
Anyone else encountered this issue? thanks!
If you're talking about this gem, it looks to be significantly outdated. I doubt it has official Rails 4 support. Someone actually submitted an issue asking if Rails 4 support will be added.
Consider using another form gem - there are plenty.
I've tried a number of things like uninstalling/reinstalling rails and gems but to no avail.
When I go into my new project and run rails s or bundle exec rails server I'm getting this error:
bin/rails:6: warning: already initialized constant APP_PATH
/Users/toabui/Sites/cms/bin/rails:6: warning: previous definition of APP_PATH was here Usage: rails COMMAND [ARGS]
Inside my bin/rails I see this code:
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
Does anyone know why I keep getting that error when I run rails s?
I've googled and it seems like there is an error with the spring gem but I can‛t seem to get it to work.
I couldn't find the an_initilizer.rb in my directory and I tried uninstalling/installing the spring gem but it didn't work.
However I did managed to finally get it working.
Apparently there is some conflict with spring and rails 4+.
I needed to run:
rake rails:update:bin
But I ran across another error:
Library not loaded: libmysqlclient.18.dylib
I ran the following command which I found on another stackoverflow post:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
Then ran the original command:
rake rails:update:bin
Then run the server command:
rails s
And now my WebBrick Server is running.
rake rails:update:bin to the rescue.
If you are on El Capitan (OS X 10.11), Security Integrity Protection (SIP) will prevent linking into /usr/lib to fix mysql. Link it into /usr/local/lib instead:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib
This is work for me.
gem uninstall mysql2
bundle install or gem install mysql2
I was getting the same error. Removed spring from Gemfile and re-bundled. Not really a solution though.
I found the code that created this error in config/initializers/an_initializer.rb
require "lib/a_file_i_need"
I changed it for
require "#{ Rails.root }/lib/a_file_i_need"
I got this error by trying to update rails 4 and imagemagick and rmagick.
So I just ran
gem uninstall rmagick
Select the All Versions option. Then try again
EDIT: This happaned again with me just now because I tried to use a gem without installing the required base gem. In my case the solution was to install 'omniauth-google' before trying to use 'omniauth-google-oauth2', but because I didn't install I got the same error again
I got the same error. I had ruby 2.1.3 and rails 4.1.6 running on Mavericks and then I migrated to Yosemite and installed the 4.2.0 rails version an ruby 2.1.5 and my apps I made in the previous version didn't work with the new one, so I made some gem sets with RVM and installed the 2.1.3 version.
Now when I wanted to run the server I got these error:
bin/rails:6: warning: already initialized constant APP_PATH
/Users/Lexynux/_WebProjects/RoR_Apps/SAIIP2/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]
And as tobu mentioned I ran:
rake rails:update:bin
I got this:
LoadError: dlopen(/Users/Lexynux/.rvm/gems/ruby-2.1.3#SAIIP2/extensions/x86_64-darwin-14/2.1.0-static/mysql2-0.3.16/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Then I ran this:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
And finally I repeated the first command it the terminal asked me for this:
Overwrite /Users/Lexynux/_WebProjects/RoR_Apps/SAIIP2/bin/rails? (enter "h" for help) [Ynaqdh]
I just typed 'Y' and hit return.
After all this I started working and going well.
Thanks.
I received this error after upgrading postgresql.
$ gem uninstall pg
$ gem install pg
resolved this issue for me.
This happened to me after doing a brew upgrade. My guess is that this broke some gems with native extensions, even though there was no error message pointing to that.
What I ended up doing was completely removing my installed gems (In my case I completely uninstalled and reinstalled the ruby version using rbenv).
Running bundle install recompiled the native extensions, and everything was running again.
I'll post what worked for me.
Comment out
gem 'spring'
Add gem 'net-shh'
and run bundle install
And restart your sever
I got the same error, it happend to be related to gem dotenv.
Instructions were to add the following to Gemfile:
gem 'dotenv', :require => 'dotenv/rails-now'
But as it turned out, dotenv/rails-now caused the error. If you use dotenv don't require rails-now
Are you using pg and mysql in different branches ? If yes, please confirm db config file.
I received this error after upgrading rails. Disabling spring give me a hint that the issue was with:
gem 'google-api-client', require: 'google/api_client'
Changed to:
gem 'google-api-client', '0.9'
Resolved the issue.
I had the same error message output when trying to start an application within a Vagrant environment. It cropped up out of nowhere after zero changes to the application code (and other weird behaviour followed, such as development.rb being deleted upon attempting to run the app).
In the end I simply halted the VM & restarted it, everything was then fine so I'm assuming it was an issue with file syncing / shared folders perhaps? (default Vagrant shared folder being used).
Run these in console:
rake tmp:clear
rake secret
IF rake rails:update:bin gives additional errors:
I had recently been doing some server maintenance and had subsequently updated OpenSSL.
When I tried running the rake rails:update:bin command, I was presented with an error relating to openSSL.
Having rebuilt my version of Ruby (`rvm reinstall ruby-x.x.x' with RVM), both errors went away.
This is always worth a try I guess.
My problem was I was using an outdated version of ruby 1.9.3 with rails 4.2. I upgraded to 2.1.2 , removed the broken project, ran rails new blog to recreate my project, navigated into my newly created app and ran rails server and it worked.
I just had this problem and found that it was being caused by the fact that I had removed a gem from the gemfile without deleting the other require references. In my case, I just had to remove it from config/application.rb.
Had this error recently, it is caused by spring, because of its suggested code in executables:
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError
end
It originally expects a LoadError for spring itself in production, but by this code all other load error will be ignored too.
Thus if you have any other LoadError in rails loading process (for example in routes/init) spring worker startup fails and then there goes branch that tries to load everything again like there was no spring.
For me this issue presented as a result of bundle upgrading rvm-capistrano amongst other things.
Adding this require:false fixed things in the end as per this previous post
gem 'rvm-capistrano', require: false
Although could possibly be an additional issue - as running rake rails:update:bin may have helped clear the initial issue.