Failed to lookup view... in views directory...

从网络上查找来看,在调试NODE.JS+EXPRESS程序时,对于新手而言,难免会出现如题所示的错误。

对于我,具体情况是:在本地运行OK(我使用了LEANCLOUD);但是,等部署到LEANCLOUD云端再运行系统时却出现错误,如下:

Error: Failed to lookup view "......" in views directory "..."


初步看起来是系统在指定视图路由位置找不到视图部分,感觉很是奇怪!本地运行正常呀!


通过翻墙头(其实不翻也可以)搜索找到如下参考答案:


地址是:http://stackoverflow.com/questions/32311710/why-is-this-error-coming-up-failed-to-lookup-view-index-in-views-directory

答案提示描述如下:


The problem was that I had changed some filenames (capitalising the 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

注意到:文中也提到“It runs fine locally.”,只是部署后运行出问题:也就是说,情形基本与我一样!

因为本人相关经验不足,于是也试了一把。仔细检查源码,表达中也是随意地使用了字母大小写。于是,严格地进行修改。再部署,运行:OK!

细节是,我的路由函数中使用了如下一句:

.(.(__dirname, ,,));

这是一个小小的例子,是想把WEX5与LEANCLOUD结合一起使用的,表达上有些随意。修改为如下严格的大小写表达方式:

.(.(__dirname, ,,));
成功了!

本文描述整体是简略了一些,但是相信有相关问题的朋友还算清楚:在EXPRESS.JS编程时路由表达时务必注意大小写!否则,在本地运行OK,但是部署时可能出现如题相似的失败!

时间: 2024-12-15 02:00:19

Failed to lookup view... in views directory...的相关文章

Failed to lookup view "error" in views directory 解决方案

新建了一个nodejs项目,默认是jade模板.改成ejs模板,使用html作为启动项.此时运行程序报错了:Failed to lookup view "error" in views directory app.js: 以下是报错: 查了一圈,发现是模板在加载的时候,views文件夹里必须有一个error,而我们制定ejs模板为html格式,所以在项目加载的时候找不到error.html而报错 所以在views文件夹下新建一个error.html,成功解决了此问题

Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??

如果你遇到了服务无法启动的情况,也不报错的,查看logs下的日志,首次安装报错如下:AH01177: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??我想日志已经说的很清楚了,这里编译安装后,配置文件conf/httpd.conf没有开启mod_slotmem_shm模块,编辑该文件,放开LoadModule slotmem_shm_module modules/mod_slotmem_shm.s

SDK Manager failed to install 'java.exe' locking directory

转自:http://stackoverflow.com/questions/13587478/sdk-manager-failed-to-install-java-exe-locking-directory I have ran into a curious error when trying to update Android SDK Tools to revision 21 from revision 20.0.3. The ADT plug-in updated properly so n

The view must derive from WebViewPage, or WebViewPage<TModel>. (The view at '~/Views/home/index.cshtml' must derive from WebViewPage, or WebViewPage<TModel>

Solution 1. Add following line on top of your cshtml file. @inherits System.Web.Mvc.WebViewPage MSDN Blogs > Gaurav's Blog > The view must derive from WebViewPage, or WebViewPage<TModel>. (The view at '~/Views/home/index.cshtml' must derive fr

svn提交错误:Commit failed (details follow): Can&#39;t create directory

重装系统后,启动svn,挂载原来的repository目录,访问正常,但提交时老发生以下错误: Commit failed (details follow): Can't create directory ***.txn: No such file or directory google一把,看到碰到这样问题的倒也不少,解决办法不多.下面这篇文章里得到个提醒:svn的repository目录转移到新机器时不要直接使用,要用svnadmin dump/load来拷贝使用.于是dump & load

nginx: [error] open() &quot;/usr/local/var/run/nginx.pid&quot; failed (2: No such file or directory)

nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory) 2017年09月14日 09:15:45 阅读数:7742 启动Nginx出现这个错误 nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory) 1  解决方法:找

nginx: [error] open() &quot;/var/run/nginx/nginx.pid&quot; failed (2: No such file or directory)

在重启nginx服务的时候,出现了这个错误. [[email protected] etc]# nginx -c /var/run/nginx/nginx.pid nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory) 解决办法: [[email protected] etc]# nginx -c /etc/nginx/nginx.conf 其他的一些解决办法: 1.进

关于nginx配置的一个报错connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory)

针对配置php的情况: linux服务器一般提示这个 connect() to unix:/tmp/php-cgi.sock failed (2: No such file or directory) while connecting to upstream, client: x.x.x.x, server: xxx.xxx.xxx, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-

nginx: [error] open() &quot;/usr/local/nginx/logs/nginx.pid&quot; failed (2: No such file or directory)

问题场景 服务器重启后,重启nginx时报错nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory),进入到logs目录发现确实没有nginx.pid文件 解决办法 使用指定nginx.conf文件的方式重启nginx /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf还有一种可能就