Error Failed To Locate View Layout Jade
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might failed to lookup view in views directory ejs have Meta Discuss the workings and policies of this site About failed to lookup view index in views directory ghost Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting 500 error: failed to lookup view "500" in views directory ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 https://github.com/expressjs/express/issues/720 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error: Failed to lookup view in Express up vote 25 down vote favorite 4 Note: my auto answer at end of the post I'm trying to make a better experience of nodeJS and i don't really like to http://stackoverflow.com/questions/10216395/error-failed-to-lookup-view-in-express get all the script in one file. so, following a post here i use this structure ./ config/ enviroment.js routes.js public/ css/ styles.css images views index index.jade section index.jade layout.jade app.js My files are right now: app.js var express = require('express'); var app = module.exports = express.createServer(); require('./config/enviroment.js')(app, express); require('./config/routes.js')(app); app.listen(3000); enviroment.js module.exports = function(app, express) { app.configure(function() { app.use(express.logger()); app.use(express.static(__dirname + '/public')); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); //extension of views }); //development configuration app.configure('development', function() { app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); //production configuration app.configure('production', function() { app.use(express.errorHandler()); }); }; routes.js module.exports = function(app) { app.get(['/','/index', '/inicio'], function(req, res) { res.render('index/index'); }); app.get('/test', function(req, res) { //res.render('index/index'); }); }; layout.jade !!! 5 html head link(rel='stylesheet', href='/css/style.css') title Express + Jade body #main h1 Content goes here #container!= body index/index.jade h1 algoa The error i get is: Error: Failed to lookup view "index/index" at Function.render (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\application.js:495:17) at render (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\response.js:614:9) at ServerResponse.render (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\response.js:638:5) at c:\xampp\htdocs\nodejs\buses\config\routes.js:4:7 at callbacks (c:\xampp\htdocs\nodejs\buses\node_modules\express\lib\router\index.js:177:11) at param (c:\xampp\htdocs\nodejs\buses\node_mo
från GoogleLogga inDolda fältSök efter grupper eller meddelanden
have Git installed. By far, the easiest way to do this is with Homebrew. Follow these Homebrew Installation Instructions. Now that you’ve got Homebrew installed, use it to install Git from within your Terminal: $ brew install git Installing Node If you don’t have Git installed, use Homebrew to install that first. Here’s a basic installation guide for Node. Getting Node’s source code If you don’t already have a place to store external source code, put it somewhere usefuls, like a “src” directory in your home folder: $ mkdir ~/src Now that we’ve got a place to put it, let’s download Node: $ cd ~/src $ git clone https://github.com/joyent/node.git $ cd node Building Node You’ll want the latest stable version. Stable version are use even numbers, while unstable dev versions use odd. At the time of this writing, the latest stable release is 0.4.7, so let’s checkout that tag before building: $ git checkout v0.4.7 # you'll get a note about a detached HEAD state. $ export JOBS=2 # optional, sets number of parallel commands. $ mkdir ~/local $ ./configure --prefix=$HOME/local/node $ make $ make install Telling your system where to find Node We’ve got to add the node bin folder to your path so that you can easily use node from the command line. Open up your .bash_profile and add Node’s path to your PATH. $ nano ~/.bash_profile If you already have a line that starts with export PATH=, just add Node’s path to the beginning. For example this: export PATH=/usr/local/bin:$PATH