赵龙 全栈之路

报错集 015 新增文件失败,终端报错

| Comments

错误记录

终端执行touch app/views/account/posts/index.html.erb出现报错

apple@MacZY ⮀ ~/rails103 ⮀ ⭠ ch07± ⮀ touch app/views/account/posts/index.html.erb
touch: app/views/account/posts/index.html.erb: No such file or directory

分析

app/views/account/posts/index.html.erb关联的文件app/controllers/account/post_controller.rb创建错误,文件名缺少一个s,正确文件名是app/controllers/account/posts_controller.rb

解决方式

终端执行rm app/controllers/account/post_controller.rb删除错误文件,终端执行rails g controller account/posts创建正确文件,再执行touch app/views/account/posts/index.html.erb,文件app/controllers/account/posts_controller.rb就正常建立。

Comments

comments powered by Disqus