2013-05-28 134 views
0

我已經搜索了一段時間,但無法解決問題。我在一臺相對較新的計算機(osx)上,迄今爲止只創建了一個rails應用程序。直到現在一切順利。現在我試圖創建一個使用由於權限導致新應用程序導致失敗

rails new appname 

這就是終端顯示我一個新的應用:

 create 
     create README.rdoc 
     create Rakefile 
     create config.ru 
     create .gitignore 
     create Gemfile 
     create app 
     create app/assets/images/rails.png 
     create app/assets/javascripts/application.js 
     create app/assets/stylesheets/application.css 
     create app/controllers/application_controller.rb 
     create app/helpers/application_helper.rb 
     create app/views/layouts/application.html.erb 
     create app/mailers/.gitkeep 
     create app/models/.gitkeep 
     create config 
     create config/routes.rb 
     create config/application.rb 
     create config/environment.rb 
     create config/environments 
     create config/environments/development.rb 
     create config/environments/production.rb 
     create config/environments/test.rb 
     create config/initializers 
     create config/initializers/backtrace_silencers.rb 
     create config/initializers/inflections.rb 
     create config/initializers/mime_types.rb 
     create config/initializers/secret_token.rb 
     create config/initializers/session_store.rb 
     create config/initializers/wrap_parameters.rb 
     create config/locales 
     create config/locales/en.yml 
     create config/boot.rb 
     create config/database.yml 
     create db 
     create db/seeds.rb 
     create doc 
     create doc/README_FOR_APP 
     create lib 
     create lib/tasks 
     create lib/tasks/.gitkeep 
     create lib/assets 
     create lib/assets/.gitkeep 
     create log 
     create log/.gitkeep 
     create public 
     create public/404.html 
     create public/422.html 
     create public/500.html 
     create public/favicon.ico 
     create public/index.html 
     create public/robots.txt 
     create script 
     create script/rails 
     create test/fixtures 
     create test/fixtures/.gitkeep 
     create test/functional 
     create test/functional/.gitkeep 
     create test/integration 
     create test/integration/.gitkeep 
     create test/unit 
     create test/unit/.gitkeep 
     create test/performance/browsing_test.rb 
     create test/test_helper.rb 
     create tmp/cache 
     create tmp/cache/assets 
     create vendor/assets/javascripts 
     create vendor/assets/javascripts/.gitkeep 
     create vendor/assets/stylesheets 
     create vendor/assets/stylesheets/.gitkeep 
     create vendor/plugins 
     create vendor/plugins/.gitkeep 
     run bundle install 
Fetching gem metadata from https://rubygems.org/........... 
Fetching gem metadata from https://rubygems.org/.. 
Resolving dependencies... 
Using rake (10.0.4) 
Using i18n (0.6.1) 
Using multi_json (1.7.4) 
Using activesupport (3.2.13) 
Using builder (3.0.4) 
Using activemodel (3.2.13) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.5) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.2) 
Installing tilt (1.4.1) 
Errno::EACCES: Permission denied - /Library/Ruby/Gems/1.8/build_info/tilt-1.4.1.info 
An error occurred while installing tilt (1.4.1), and Bundler cannot continue. 
Make sure that `gem install tilt -v '1.4.1'` succeeds before bundling. 

當我進入

gem install tilt -v '1.4.1' 

我得到如下:

ERROR: While executing gem ... (Gem::FilePermissionError) 
    You don't have write permissions for the /Library/Ruby/Gems/1.8 directory. 

在搜索時我發現了peo有類似的外觀錯誤,但我找不到解決我的具體問題的任何事情。

我使用ruby 2.0.0和rails 2.3.13。

我真的卡住了,希望有人知道如何解決這個問題。提前致謝!

更新:我注意到,當我運行軌道的新應用程序的命令,終端問我

Enter your password to install the bundled RubyGems to your system: 

它從來沒有這樣做過。我有可能改變了系統上的某些東西嗎?

Update2:對此使用2+天后,據我所知,解決方案是完全重新安裝最新版本的ruby和rails。

+0

您使用[RVM(https://rvm.io)? –

+0

另請注意,使用rails時,最好將gem文件放入'Gemfile'並讓'bundle'(或'sudo bundle')進行安裝。你可能也想看看'rvm'。 –

+0

是的,我正在使用rvm,但我不知道如何使用它來解決這個問題。 「rails new」成功後不會使用「sudo bundle」嗎?這似乎是整個初始設置得到中止的方式太早?非常感謝! – Linus

回答

1

嘗試sudo gem install tilt -v '1.4.1'

+0

當我運行這個,有不同的寶石出現一些其他類似的錯誤。對於每次我不想創建新應用程序時都不會安裝的所有寶石,我是否必須運行此命令? – Linus

+0

@LinusAn我還沒找到解決辦法。但我通常只在windows上得到這個錯誤 –

+0

是的,這就是爲什麼我首先在​​Mac上,但這次似乎沒有保護手;)無論如何,謝謝! – Linus

2

嘗試sudo 或目錄中。如果sudo的「創業板安裝傾斜-v‘1.4.1’」不工作這是你

+0

我試圖在桌面上創建應用程序,但沒有奏效。我應該使用什麼目錄? – Linus

+0

只要運行的用戶具有創建權限,就可以使用哪個文件夾。我的首選項是我把網絡的東西放在/ var/www/foldername –

1

訪問創建應用。 然後大多數人喜歡,這個組「其他人」在你的Ruby innstall中沒有正確的權限。 確保,你在給了組=他人或用戶正確的權限運行以下命令:

/Library/Ruby/Gems/1.8

+0

當我在路徑中運行gem install tilt -v'1.4.1'時,我又收到以下錯誤:錯誤:執行gem時(Errno :: EACCES) 權限被拒絕 - /Library/Ruby/Gems/1.8/tilt-1.4.1.gem – Linus

+0

你可以在「你的Ruby安裝目錄/庫/ Ruby/Gems/1.8」上列出目錄權限嗎? –

+0

我該怎麼做?非常感謝您的幫助! – Linus

相關問題