'devise' gem - 权限被拒绝@rb_sysopen
'devise' gem - permission denied @rb_sysopen
我已经安装了'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文件
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'。它抛出同样的错误。
在你的位置,我会尝试更改导致 EACCESS 错误的文件的 chmod。
在您的示例中,它将是 /home/cbls-2/academics/assistant/config/routes.rb
运行 在你的项目目录下这个命令:
sudo chmod -R 1777 /tmp
您好,请更改文件的权限 /home/cbls-2/academics/assistant/config/routes.rb
它会起作用。
我已经安装了'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文件
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'。它抛出同样的错误。
在你的位置,我会尝试更改导致 EACCESS 错误的文件的 chmod。 在您的示例中,它将是 /home/cbls-2/academics/assistant/config/routes.rb
运行 在你的项目目录下这个命令:
sudo chmod -R 1777 /tmp
您好,请更改文件的权限 /home/cbls-2/academics/assistant/config/routes.rb
它会起作用。