2013-05-04 40 views
1

我正在學習ruby on rails ...我已經能夠在我的OSX(10.8.3)本地主機上安裝一個應用程序,但它是非常有問題的大多數命令都失敗了,因爲許可相關的錯誤,除非我使用sudo:Ruby on Rails:爲什麼我必須使用sudo來執行命令?

$ refinerycms ./

$ bundle install

$ bundle update

$ rails server

全部關閉這些失敗的機智豪特sudo...,我不知道爲什麼。這樣做有點麻煩,但更重要的是,似乎我在設置過程中必須做出錯誤的事情纔會發生。有誰知道我做錯了什麼,以及如何解決它?

更新我懷疑這可能是相關的: (注意:指向同一個地方。)

$ gem environment 
RubyGems Environment: 
    - RUBYGEMS VERSION: 2.0.3 
    - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.4.0] 
    - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194 
    - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby 
    - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194/bin 
    - RUBYGEMS PLATFORMS: 
    - ruby 
    - x86_64-darwin-11 
    - GEM PATHS: 
    - /usr/local/rvm/gems/ruby-1.9.3-p194 
    - /usr/local/rvm/gems/[email protected] 
    - GEM CONFIGURATION: 
    - :update_sources => true 
    - :verbose => true 
    - :backtrace => false 
    - :bulk_threshold => 1000 
    - REMOTE SOURCES: 
    - https://rubygems.org/ 


$ sudo gem environment 
Password: 
RubyGems Environment: 
    - RUBYGEMS VERSION: 2.0.3 
    - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.4.0] 
    - INSTALLATION DIRECTORY: /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1 
    - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby 
    - EXECUTABLE DIRECTORY: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin 
    - RUBYGEMS PLATFORMS: 
    - ruby 
    - x86_64-darwin-11 
    - GEM PATHS: 
    - /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1 
    - /Users/ESL/.gem/ruby/1.9.1 
    - GEM CONFIGURATION: 
    - :update_sources => true 
    - :verbose => true 
    - :backtrace => false 
    - :bulk_threshold => 1000 
    - REMOTE SOURCES: 
    - https://rubygems.org/ 

這可能會或可能不會進行相關的事實~/.rvm不存在。在任何地方都不會出現.rvm

更新2我對軌道應用程序瞭解不多,但我注意到某些文件似乎屬於系統而不是我的用戶。這是正常的嗎?

更新3我的預感是我所有的寶石都與root相關,而不是我的用戶,這就解釋了爲什麼我每次嘗試做事都會收到權限錯誤。所以,我想重新安裝RVM爲用戶...

$ \curl -L https://get.rvm.io | bash -s stable 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
100 184 100 184 0  0 192  0 --:--:-- --:--:-- --:--:-- 223 
100 13641 100 13641 0  0 9060  0 0:00:01 0:00:01 --:--:-- 9060 
Downloading RVM from wayneeseguin branch stable 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
100 124 100 124 0  0 381  0 --:--:-- --:--:-- --:--:-- 475 
100 3263k 100 3263k 0  0 536k  0 0:00:06 0:00:06 --:--:-- 615k 

Upgrading the RVM installation in /usr/local/rvm/ 
    RVM PATH line found in /Users/ESL/.bashrc /Users/ESL/.zshrc. 
    RVM sourcing line found in /Users/ESL/.bash_profile /Users/ESL/.zprofile. 

Upgrade Notes: 


    * WARNING: you have 'rvm_configure_env' in /etc/rvmrc, run the following to fix: 

     sudo sed -i'' -e "/rvm_configure_env=.*\/opt\/sm/d" /etc/rvmrc 
     rvm autolibs smf 

    * No new notes to display. 

# RVM: Shell scripts enabling management of multiple ruby environments. 
# RTFM: https://rvm.io/ 
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net) 
# Cheatsheet: http://cheat.errtheblog.com/s/rvm 
# Screencast: http://screencasts.org/episodes/how-to-use-rvm 

# In case of any issues run 'rvm requirements' or read 'rvm notes' 

Upgrade of RVM in /usr/local/rvm/ is complete. 

# 
# Thank you for using RVM! 
# I sincerely hope that RVM helps to make your life easier and 
# more enjoyable!!! 
# 
# ~Wayne 

It seems to have worked, but it looks to me like it keeps landing in the root instead of /Users/ME. Am I onto something? 

更新

$ \curl -L https://get.rvm.io | bash -s stable 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
100 184 100 184 0  0 124  0 0:00:01 0:00:01 --:--:-- 143 
100 13641 100 13641 0  0 6907  0 0:00:01 0:00:01 --:--:-- 6907 
Downloading RVM from wayneeseguin branch stable 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
100 124 100 124 0  0 561  0 --:--:-- --:--:-- --:--:-- 712 
100 3263k 100 3263k 0  0 767k  0 0:00:04 0:00:04 --:--:-- 907k 

Installing RVM to /usr/local/rvm/ 
    RVM PATH line found in /Users/ESL/.bashrc /Users/ESL/.zshrc. 
    RVM sourcing line found in /Users/ESL/.bash_profile /Users/ESL/.zprofile. 

# RVM: Shell scripts enabling management of multiple ruby environments. 
# RTFM: https://rvm.io/ 
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net) 
# Cheatsheet: http://cheat.errtheblog.com/s/rvm 
# Screencast: http://screencasts.org/episodes/how-to-use-rvm 

# In case of any issues run 'rvm requirements' or read 'rvm notes' 

Installation of RVM in /usr/local/rvm/ is almost complete: 

    * First you need to add all users that will be using rvm to 'rvm' group, 
    and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`. 

    * To start using RVM you need to run `source /usr/local/rvm/scripts/rvm` 
    in all your open shell windows, in rare cases you need to reopen all shell windows. 

# 
# Thank you for using RVM! 
# I sincerely hope that RVM helps to make your life easier and 
# more enjoyable!!! 
# 
# ~Wayne 
+0

如果你在你的項目文件夾中鍵入你的控制檯「ruby」,會出現什麼內容?我認爲你正在使用mac系統ruby可能.. – Mattherick 2013-05-04 14:42:49

+0

我得到'/ usr/local/rvm/rubies/ruby​​-1.9.3-p194/bin/ruby​​'這是rvm對不對? – emersonthis 2013-05-04 15:57:47

+0

我對rails應用程序瞭解不多,但是我注意到某些文件似乎屬於系統而不是我的用戶。這是正常的嗎?例如:'goodwatching/config/initializers/refinery/core.rb' – emersonthis 2013-05-04 16:08:43

回答

1

你正確安裝RVM,這是很容易做到。 「這通常是因爲人們以root身份執行安裝,而不是從非特權用戶帳戶執行安裝指令。」我建議完全使用sudo rvm implode刪除RVM,並在單用戶模式下重新安裝。像你一樣運行,不是root,不是sudo:

\curl -L https://get.rvm.io | bash -s stable 
+0

我試過你說的,它看起來像它再次安裝在根目錄下。我在上面添加了一個新的更新... – emersonthis 2013-05-04 22:16:29

+0

'sudo rvm implode'的結果是什麼?您可能需要先徹底刪除rvm。請參閱[我如何徹底清除系統中的所有RVM痕跡,包括系統範圍的安裝?](https://rvm.io/support/troubleshooting/) – Sara 2013-05-04 22:31:07

+0

我會查看您的鏈接。當我做'sudo rvm implode'時沒有消息,所以我認爲它工作。 rails和其他ruby命令不起作用。我擔心的唯一原因是再次看起來像根的路徑。 – emersonthis 2013-05-04 23:23:36

相關問題