2013-01-09 4 views
0

에 루비와 함께 작동하지 않습니다. 그러나 프로젝트 디렉토리에서 $ rails s을 실행하여 로컬 서버를 시작할 때마다이 오류가 발생합니다.MacPorts를 설치 내가 포스트 그레스를 사용하고 레일에 이미 존재하는 루비 프로젝트로 작업하기 위해 PostgreSQL을 설치를 시도하고있어 레일

=> Booting Thin 
=> Rails 3.2.9 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
Exiting 
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in `load': 
/Users/******/Documents/Jellyfish/config/initializers/session_store.rb:3: syntax 
error, unexpected ':', expecting $end (SyntaxError) 
...sion_store :cookie_store, key: '_Jellyfish_session' 
         ^
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in `load' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:245:in `load' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/engine.rb:588 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/engine.rb:587:in `each' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/engine.rb:587 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `run_initializers' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `send' 
from /opt/local/lib/ruby/gems/1.8/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing' 
from /Users/******/Documents/Jellyfish/config/environment.rb:5 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:236:in `load_dependency' 
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251:in `require' 
from /Users/******/Documents/Jellyfish/config.ru:3 
from /opt/local/lib/ruby/gems/1.8/gems/rack-1.4.2/lib/rack/builder.rb:51:in `instance_eval' 
from /opt/local/lib/ruby/gems/1.8/gems/rack-1.4.2/lib/rack/builder.rb:51:in `initialize' 
from /Users/******/Documents/Jellyfish/config.ru:0:in `new' 
from /Users/******/Documents/Jellyfish/config.ru:0 

이 문제는 내 database.yml 파일의 로그인 정보 또는 postgres의 설치와 관련이 있다고 생각됩니다.

나는 macports와 명령 sudo port install postgresql83 postgresql83-server을 사용하여 postgres를 설치했으며 sudo env ARCHFLAGS="-arch x86_64" gem install pggem install pg -- --with-pg-config=/opt/local/lib/postgresql83/bin/pg_config을 모두 실행 한 보석을 설치했습니다.

내 컴퓨터 사용자 이름/pwd, postgres/빈 pwd, pg/빈 pwd, postgres/시스템 pwd와 같은 database.yml 파일에서 usernames/pwd의 여러 조합을 시도했지만 그 중 아무 것도 나타나지 않습니다. 일하고있다.

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied 
could not identify current directory: Permission denied 
could not identify current directory: Permission denied 
could not identify current directory: Permission denied 
The program "postgres" is needed by initdb but was not found in the 
same directory as "initdb". 
Check your installation. 

I : 내가 생각할 수있는

마지막 것은 설치 프로그램에 의해 제안 내가

sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb 
sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb 
sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb' 

을 사용하여 데이터베이스 인스턴스를 만들려고 할 때, 그것은 내게 오류를 준다이다 이 정보가 작업하기에 충분한 정보가되기를 바랍니다. 사람들이 비슷한 문제를 겪고있는 몇 가지 질문을 찾았지만 솔루션 중 어느 것도 나를 위해 일하는 것 같지 않습니다. 이것을 읽어 주셔서 너무 고마워요.

답변

1

나는 포스트 그레스 설치가 작동을 보장 할 수는 없지만 여기에 실제 문제는 루비 1.8에 레일 3.2.9을 실행하는 것입니다. 얻는 특정 오류는 config/initializers/session_store.rb에 있으며 '_Jellyfish_session'키 :> = '_Jellyfish_session'키를 변경하면 해결할 수 있지만 그 후에도 다른 오류가 발생할 수 있습니다. 이론적으로 Rails 3.2.9는 ruby ​​1.8에서 작동해야한다고 생각하지만 가능한 경우 1.9로 업데이트 할 것을 권장합니다.

좀 더보고 후, 당신은 수행하여 1.8으로 레일 응용 프로그램을 설정할 수 있어야한다 :이 같이 1.8 스타일의 해시를 사용하는 모든 기본 파일을 설정합니다

rails new myappname --old-style-hash 

이 : 다음과 같이

{ :key => 'value' } 

보다는 새로운 스타일 :

{ key: 'value' } 

주를이 두 스타일 모두 1.9에서 지원되지만 이전 버전은 1.8에서만 지원됩니다.

+0

안녕하세요 차드, 답변 해 주셔서 감사합니다. 나는 당신의 후자의 제안을 시도하는 것에 익숙하지 않았지만, 대신 포트 대신 homebrew를 사용하여 Ruby 1.9를 새로 재설치하려고합니다. 두 개는 상충되는 것 같습니다. 나는 내 시스템에서 루비를 완전히 지우고 다시 시작할 수 있는지 또 다른 글을 올릴 것이다. 실수로 내 시스템 루비를 지워 버렸을 지 모르겠습니다. 다시 한 번 감사드립니다! – user1959978

+0

rvm - https://rvm.io/ homebrew보다 훨씬 덜 번거롭기 때문에 버전을 쉽게 전환하거나 업그레이드하거나 시스템 버전으로 되돌릴 수 있습니다. – Chad