Looking from the network, in debugging Node.js+express program, for beginners, it is inevitable that the error shown in title.
For me, the situation is: Run OK locally (I used leancloud), but there was an error when deploying to Leancloud cloud to run the system, as follows:
error:failed to Lookup View "..." In the views directory "..."
The initial look is that the system cannot find the view section in the specified view routing location, it feels strange! Local Operation OK!
By flipping the wall (in fact, can not be turned) search to find the following reference answers:
Address is: http://stackoverflow.com/questions/32311710/why-is-this-error-coming-up-failed-to-lookup-view-index-in-views-directory
The answer hints are described below:
The problem is that I had changed some filenames (capitalisingthe first letter), and then changed it back, but It never logged it. Typing Heroku Run ' ls-al '
Into the shell creates a one-off dyno and displays the File-system as Heroku sees it. This is the thread that solved my problem: Heroku cannot find module |
Note: The article also mentions "It runs fine locally.", just run the problem after deployment: that is, the situation is basically the same as me!
Because I have insufficient experience, so I tried a. Careful examination of the source code, the expression is also arbitrarily used in the case of letters. Accordingly, the changes are strictly made. Re-deploy, run: ok!
The detail is that my routing function uses the following sentence:
. (. (__dirname,,,));
This is a small example, is to use WEX5 and leancloud together, the expression of some random. Modify to the following strict case representation:
. (. (__dirname,,,));
It worked!
This article describes the overall is a little bit, but believe that the relevant questions of friends are still clear: in Express.js programming when the route expression must pay attention to the case! Otherwise, run OK locally, but there may be title similar failures at deployment!
This article is from the "Green Peak" blog, please make sure to keep this source http://zhuxianzhong.blog.51cto.com/157061/1786113
Failed to Lookup View ... in the views directory ...