運行簡單的命令權限被拒絕@ dir_s_mkdir - /規格(錯誤:: EACCES)
rails g model User
導致:省略
→ bundle exec rails g model User
invoke active_record
create db/migrate/20160128191020_create_users.rb
create app/models/user.rb
invoke rspec
create spec/models/user_spec.rb
invoke factory_girl
create /spec/factories/users.rb
/Users/khataev/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir': Permission denied @ dir_s_mkdir - /spec (Errno::EACCES)
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:210:in `each'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:61:in `block in invoke!'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `call'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:116:in `invoke_with_conflict_check'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:in `invoke!'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/actions/create_file.rb:25:in `create_file'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/factory_girl_rails-4.5.0/lib/generators/factory_girl/model/model_generator.rb:46:in `create_factory_file'
from /Users/khataev/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/factory_girl_rails-4.5.0/lib/generators/factory_girl/model/model_generator.rb:25:in `create_fixture_file'
休息。
我正在使用工廠女孩軌道。 spec
和spec/factories folders
'權限爲drwxr-xr-x(755,更改爲777無效)。重新安裝factory_girl_rails
沒有效果。 Ruby 2.2.2
(試過不同的版本的話)
'/ spec/factories/users.rb'是問題所在,它試圖在根目錄下創建'spec'目錄。但爲什麼會這樣呢? :) –
任何爲'FactoryGirl.definition_file_paths'設置值的機會?它看起來好像'/ spec/factories'的值已經覆蓋了'spec/factories'(即,根級別而不是相對於當前文件夾)。 – AndyV