質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

3064閲覧

Rails 5 `initialize': Permission denied @ rb_sysopen エラー

igar

総合スコア110

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2018/07/07 03:39

`initialize': Permission denied @ rb_sysopenエラーが出てしまい、scaffoldができない状況です。
destoryしてみても変わりません…。
他の名前でならscaffoldできるのですが。

変な操作はしてないのですが…なぜ急にできなくなったのでしょうか。

PS C:\pg\RAILS\devise> rails generate scaffold Hashmodel title:string content:text invoke active_record identical db/migrate/20180707032214_create_hashmodels.rb identical app/models/hashmodel.rb invoke test_unit identical test/models/hashmodel_test.rb identical test/fixtures/hashmodels.yml invoke resource_route route resources :hashmodels invoke scaffold_controller identical app/controllers/hashmodels_controller.rb invoke erb exist app/views/hashmodels C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:63:in `initialize': Permission denied @ rb_sysopen - C:/pg/RAILS/devise/app/views/hashmodels/index.html.erb (Errno::EACCES) from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:63:in `open' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:63:in `block in invoke!' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/empty_directory.rb:117:in `invoke_with_conflict_check' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:60:in `invoke!' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions.rb:94:in `action' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:25:in `create_file' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/file_manipulation.rb:119:in `template' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/named_base.rb:25:in `block in template' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/named_base.rb:49:in `inside_template' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/named_base.rb:24:in `template' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/erb/scaffold/scaffold_generator.rb:21:in `block (2 levels) in copy_view_files' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/erb/scaffold/scaffold_generator.rb:19:in `each' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/erb/scaffold/scaffold_generator.rb:19:in `block in copy_view_files' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/erb/scaffold/scaffold_generator.rb:18:in `each' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/erb/scaffold/scaffold_generator.rb:18:in `copy_view_files' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:115:in `invoke' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb:26:in `block in <class:ScaffoldControllerGenerator>' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:274:in `instance_exec' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:274:in `block in _invoke_for_class_method' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/shell.rb:68:in `with_padding' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:266:in `_invoke_for_class_method' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:133:in `_invoke_from_option_template_engine' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:115:in `invoke' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:277:in `block in _invoke_for_class_method' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/shell.rb:68:in `with_padding' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:266:in `_invoke_for_class_method' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:133:in `_invoke_from_option_scaffold_controller' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/generators.rb:276:in `invoke' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/commands/generate/generate_command.rb:26:in `perform' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<top (required)>' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require' from bin/rails:4:in `<main>' PS C:\pg\RAILS\devise> rails d scaffold Hashmodel title:string content:text PS C:\pg\RAILS\devise> rails generate scaffold Hashmodel title:string content:text invoke active_record create db/migrate/20180707033046_create_hashmodels.rb create app/models/hashmodel.rb invoke test_unit create test/models/hashmodel_test.rb create test/fixtures/hashmodels.yml invoke resource_route route resources :hashmodels invoke scaffold_controller create app/controllers/hashmodels_controller.rb invoke erb exist app/views/hashmodels C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:63:in `initialize': Permission denied @ rb_sysopen - C:/pg/RAILS/devise/app/views/hashmodels/index.html.erb (Errno::EACCES) from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:63:in `open' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/thor-0.20.0/lib/thor/actions/create_file.rb:63:in `block in invoke!' ... PS C:\pg\RAILS\devise>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

コマンドプロンプトを実行する際、管理者として実行したことがあったのではないでしょうか。
その場合、管理者ではないユーザ権限で同じファイルを変更しようとするとこのエラーが出るのではないかと思われます(/app/views/hashmodels/index.html.erb以外のファイルについては、identicalとあるので、たまたま同じ内容で書き換えが行われなかったのでエラーになっていない可能性があります)。

一度、管理者権限でプロジェクト全体を削除してから作り直すか、このプロジェクトについては管理者権限で作ることにするかするのはいかがでしょうか。

投稿2018/07/26 13:13

takahashim

総合スコア1877

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問