简体   繁体   中英

Controller is missing a template for request formats: text/html

Based on all the other threads I've read, this is typically because the view isn't in the expected location. But I've gone through my directory a number of times, checked my controller and routes files, and AFAIK, everything seems in order.

Here's the error: PagesController#index is missing a template for request formats: text/html

Here's a screenshot of my directory and my Routes file: 在此处输入图片说明

Here's my Pages controller:

class PagesController < ApplicationController
    def index
    end
end

I have a feeling there is something very obvious that I'm missing...

I had the same issue on a site I am building. The funny or strange thing is that when stopped working last night everything worked fine, and I could see all the pages on my site. But when I started the server this morning - 5 hours later - I got an error similar to yours.

The only change in my environment was that I used Windows PowerShell to start the rails server. So I switched to Command Prompt, and promptly got another error message - something to the effect that the server was still running. I deleted this file >>> /tmp/pis/server.pid and reran the server, et voila! everything worked like before. Interesting enough I do have Powershell Core (the cross-platform PS) installed, and it also does not give me any problem at all.Is it something to do with Windows Powershell ? I don't know, it just solved my issue for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM