rails server bin/rails:6: warning: already initialized constant APP_PATH error

前端 未结 20 740
别那么骄傲
别那么骄傲 2020-11-30 22:42

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 serv

相关标签:
20条回答
  • 2020-11-30 23:08

    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.

    0 讨论(0)
  • 2020-11-30 23:10

    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.

    0 讨论(0)
  • 2020-11-30 23:10

    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

    0 讨论(0)
  • 2020-11-30 23:10

    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.

    0 讨论(0)
  • 2020-11-30 23:11

    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

    0 讨论(0)
  • 2020-11-30 23:12

    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).

    0 讨论(0)
提交回复
热议问题