Open mcshakes opened 8 years ago
Can confirm. Found this when searching for an analogous error when generating controllers. This does not affect Rails 5 on my Linux Mint amd64 desktop, but does affect Rails 5 on my ARM Chromebook with Debian Jessie chroot.
Edit: Actually, I ran spring stop
, tried again, and rails g
complained of a syntax error in my routes.rb
. I forgot a do
. Still not sure why that error didn't come up the first time and rails g
hanged.
I just ran into this myself. What I found was that rails g model fails if you don't have ActiveRecord or Mongo installed. I had built a rails 5 api project with --skip-active-record and I can generate controllers but not models.
This just happened to me as well (Rails 5.1).
@mcshakes I solved my problem with like this in root project.
I have used Rails 5.1 with module --api
echo "--skip-spring" >> ~/.railsrc
With spring
, all my rails generate
commands hang. 😞
With
spring
, all myrails generate
commands hang. disappointed
Same problem with Rails 5.2.2, Spring 2.0.2 and ruby 2.3. Need to call spring stop
before running any generator. Can be demonstrated with with clean new Rails app, adding the devise Gem and then running rails generate devise:install
Seems like the problem could be with spring losing track of the environment. If I do this
1) rails new myapp -d postgresql
2) cd myapp
3) Add gem 'devise'
to Gemfile
4) bundle install
5) su - someotherid
6) exit
7) rails generate devise:install
Then spring will cause 7) to hang. But if I miss out 5) and 6) everything works fine.
These kinds of errors have been happening for years. Everyone I know just uninstalls Spring from their Rails projects. We need a testing box that automates if all of the Rails commands work when Spring is installed. Tests need run on all major Operating Systems.
Hey everyone, not sure I'm in the right place, but my searches have led me here.. Im having issues with rails generate migration
, which worked perfectly for years until I upgraded to ruby 2.6.5
➜ esl_search git:(updateaddress) spring stop [2.6.5]
Spring stopped.
➜ esl_search git:(updateaddress) rails generate migration RemoveAdsFromConsultations address:string [2.6.5]
warning package.json: No license field
warning No license field
Running via Spring preloader in process 51640
Traceback (most recent call last):
/usr/local/Cellar/rbenv/1.1.2/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': cannot load such file -- rails/generators/migration/migration/migration_generator (LoadError)
/usr/local/Cellar/rbenv/1.1.2/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
/usr/local/Cellar/rbenv/1.1.2/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `join' for nil:NilClass (NoMethodError)
/usr/local/Cellar/rbenv/1.1.2/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
/usr/local/Cellar/rbenv/1.1.2/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
/usr/local/Cellar/rbenv/1.1.2/versions/2.6.5/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
stop spring
is not working for me.. any ideas? Thanks
Kill spring with ps auwwx | grep spring to get the pid and then kill -9 pid (this should be the pid)
Kill spring with ps auwwx | grep spring to get the pid and then kill -9 pid (this should be the pid)
thanks for the reply; I'm a total noob with spring and associated commands. are you saying ps auwwx | grep spring
followed by kill -9 pid
in the terminal?? also what could be the cause of the initial problem? Thanks again!
For anyone landing here having the same problems as matthewgoodwin:
https://stackoverflow.com/a/56241794/6751482 fixed the very same issue for me.
Simply stopping spring did not seem to work in this case.
When trying to generate new models, it would hang there until I was forced to abort with ctrl-c. I got these error logs
So I did
spring stop
, and retried the above generator to get this:Considering how little I know about Spring, and whether something else will break later, I'm wondering if I did something wrong in the process of upgrading my Ruby version, my bundler and upgrading to Rails 5. Or if this is more of an issue local to Spring. Let me know if you need any more details.