我已经安装了'devise'gem。
当我试图跑
时rails g devise User
我收到以下错误。
/home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:101:in `initialize': Permission denied @ rb_sysopen - /home/cbls-2/academics/assistant/config/routes.rb (Errno::EACCES)
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:101:in `open'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:101:in `replace!'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:59:in `invoke!'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:94:in `action'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:30:in `insert_into_file'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/generators/actions.rb:224:in `block in route'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:194:in `block in in_root'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:184:in `block in inside'
from /home/cbls-2/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:128:in `chdir'
from /home/cbls-2/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/fileutils.rb:128:in `cd'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:184:in `inside'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/actions.rb:194:in `in_root'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/generators/actions.rb:223:in `route'
from /home/cbls-2/.rvm/gems/ruby-2.3.0/gems/devise-4.1.0/lib/generators/devise/devise_generator.rb:22:in `add_devise_routes'
我有Rails 4.2.6,Ruby 2.3.0
这是我的宝石文件
gem 'rails', '4.2.6'
gem 'mysql2'
gem 'devise'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'
gem 'unicorn'
gem 'capistrano-rails', group: :development
group :development, :test do
debugger console
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
无法运行'rails g activeadmin:resource User'。它会抛出同样的错误。
答案 0 :(得分:1)
您好请更改文件/home/cbls-2/academics/assistant/config/routes.rb
的权限。它将起作用。
答案 1 :(得分:0)
在你的位置我会尝试更改chmod for file导致EACCESS错误。 在您的示例中,它将是/home/cbls-2/academics/assistant/config/routes.rb
答案 2 :(得分:0)
在项目目录中运行此命令:
sudo chmod -R 1777 /tmp