Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
989 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...