Failed to Lookup View ... in the views directory ...

Source: Internet
Author: User

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 ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.